• Caleb Spare's avatar
    encoding/json: support maps with integer keys · f05c3aa2
    Caleb Spare authored
    This change makes encoding and decoding support integer types in map
    keys, converting to/from JSON string keys.
    
    JSON object keys are still sorted lexically, even though the keys may be
    integer strings.
    
    For backwards-compatibility, the existing Text(Un)Marshaler support for
    map keys (added in CL 20356) does not take precedence over the default
    encoding for string types. There is no such concern for integer types,
    so integer map key encoding is only used as a fallback if the map key
    type is not a Text(Un)Marshaler.
    
    Fixes #12529.
    
    Change-Id: I7e68c34f9cd19704b1d233a9862da15fabf0908a
    Reviewed-on: https://go-review.googlesource.com/22060Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    f05c3aa2
Name
Last commit
Last update
..
testdata Loading commit data...
bench_test.go Loading commit data...
decode.go Loading commit data...
decode_test.go Loading commit data...
encode.go Loading commit data...
encode_test.go Loading commit data...
example_test.go Loading commit data...
fold.go Loading commit data...
fold_test.go Loading commit data...
indent.go Loading commit data...
number_test.go Loading commit data...
scanner.go Loading commit data...
scanner_test.go Loading commit data...
stream.go Loading commit data...
stream_test.go Loading commit data...
tagkey_test.go Loading commit data...
tags.go Loading commit data...
tags_test.go Loading commit data...