]> Cypherpunks repositories - gostls13.git/commit
json: preserve field name case by default
authorRuss Cox <rsc@golang.org>
Tue, 27 Apr 2010 17:24:00 +0000 (10:24 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 27 Apr 2010 17:24:00 +0000 (10:24 -0700)
commitbec40ba516e2c8ff4cbcd0eaa3dc84a03c230289
treedfcfb493c4624718c2fb954e87004f9d4428e359
parentcc62bed075ed2a7d1f65f2d65e55af1ffab7cdba
json: preserve field name case by default

This matches the old JSON package behavior.
All lowercase names are not as standard as I believed,
and it seems less surprising to need to write

type T struct { Field string "field" }

to get lower case (behavior after this CL) than it does to need
to write

type T struct { Field string "Field" }

to preserve the case (behavior before this CL).

Also test and  fix unmarshal into non-nil interface
value or pointer.

Fixes #744.

R=r
CC=golang-dev
https://golang.org/cl/1013041
src/pkg/json/decode.go
src/pkg/json/decode_test.go
src/pkg/json/encode.go