1package main 2 3import ( 4 "bytes" 5 "fmt" 6 "testing" 7 8 "github.com/segmentio/encoding/json" 9) 10 11func 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} 24