]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/json: document case-insensitive Unmarshal key matching
authorRuss Cox <rsc@golang.org>
Thu, 31 Jan 2013 15:49:23 +0000 (07:49 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 31 Jan 2013 15:49:23 +0000 (07:49 -0800)
Fixes #4664.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7237060

src/pkg/encoding/json/decode.go

index 6109450221864e29988f846f00505a87724e39eb..1d723af12b5b9e4f7e57c5b2559c66add8434f02 100644 (file)
@@ -33,6 +33,10 @@ import (
 // the value pointed at by the pointer.  If the pointer is nil, Unmarshal
 // allocates a new value for it to point to.
 //
+// To unmarshal JSON into a struct, Unmarshal matches incoming object
+// keys to the keys used by Marshal (either the struct field name or its tag),
+// preferring an exact match but also accepting a case-insensitive match.
+//
 // To unmarshal JSON into an interface value, Unmarshal unmarshals
 // the JSON into the concrete value contained in the interface value.
 // If the interface value is nil, that is, has no concrete value stored in it,