]> Cypherpunks repositories - gostls13.git/commit
json: add struct tag option to wrap literals in strings
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 29 Aug 2011 19:46:32 +0000 (12:46 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 29 Aug 2011 19:46:32 +0000 (12:46 -0700)
commit596bf61d6cb19d0d39c0adb5c210932279fc795d
treed7360aa93dadf3a79c586e35703edc3d38030cca
parent2afc46f2b213336ca4ac1d518b9e9d4f6b5b0fbc
json: add struct tag option to wrap literals in strings

Since JavaScript doesn't have [u]int64 types, some JSON APIs
encode such types as strings to avoid losing precision.

This adds a new struct tag option ",string" to cause
fields to be wrapped in JSON strings on encoding
and unwrapped from strings when decoding.

R=rsc, gustavo
CC=golang-dev
https://golang.org/cl/4918051
src/pkg/json/Makefile
src/pkg/json/decode.go
src/pkg/json/decode_test.go
src/pkg/json/encode.go
src/pkg/json/encode_test.go
src/pkg/json/tags.go [new file with mode: 0644]
src/pkg/json/tags_test.go [new file with mode: 0644]