I want to do a json.Unmarshal of []byte data whilst also getting the 
disallowUnknownFields behaviour.  Is there any tidier way than this 
<https://play.golang.org/p/oSLBiFxj4kt>?

dec := json.NewDecoder(bytes.NewReader(data))
dec.DisallowUnknownFields()
var v mystruct
err := dec.Decode(&v)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5c1c7101-8ead-46b2-9e58-8b7f26203be0o%40googlegroups.com.

Reply via email to