github.com/segmentio/encoding@v0.4.0/json/bugs/issue18/main_test.go (about)

     1  package main
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"testing"
     7  
     8  	"github.com/segmentio/encoding/json"
     9  )
    10  
    11  func TestIssue18(t *testing.T) {
    12  	b := []byte(`{
    13  	"userId": "blah",
    14  	}`)
    15  
    16  	d := json.NewDecoder(bytes.NewReader(b))
    17  
    18  	var a struct {
    19  		UserId string `json:"userId"`
    20  	}
    21  	fmt.Println(d.Decode(&a))
    22  	fmt.Println(a)
    23  }