[go-nuts] Re: encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Brian Stengaard
On Tuesday, 2 May 2017 16:02:47 UTC-4, Pierre Curto wrote: > > Hello, > > My guess: > If you dont pass in a pointer, then you pass a value. > What would be the point of updating the value that you will never see and > that will get discarded? > Hence it returns a map that provides the

[go-nuts] encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Brian Stengaard
Hey Gophers, When unmarshalling JSON into a struct with a blank interface (interface{}) I get a surprising result: If I set the field to a pointer to a T value before unmarshalling, the data is filled out on the T value as expected. (See I2 in the playground example.) If I set the field to a