]> Cypherpunks repositories - gostls13.git/commit
encoding/json: allow non-string type keys for (un-)marshal
authorAugusto Roman <aroman@gmail.com>
Tue, 8 Mar 2016 20:41:35 +0000 (12:41 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 5 Apr 2016 15:08:04 +0000 (15:08 +0000)
commitffbd31e9f79ad8b6aaeceac1397678e237581064
tree1f6a77560f5d80df8b1198d496156a5c5f47a703
parentacefcb732cae4daa59a621cb102793860b564a12
encoding/json: allow non-string type keys for (un-)marshal

This CL allows JSON-encoding & -decoding maps whose keys are types that
implement encoding.TextMarshaler / TextUnmarshaler.

During encode, the map keys are marshaled upfront so that they can be
sorted.

Fixes #12146

Change-Id: I43809750a7ad82a3603662f095c7baf75fd172da
Reviewed-on: https://go-review.googlesource.com/20356
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/encoding/json/decode.go
src/encoding/json/decode_test.go
src/encoding/json/encode.go
src/encoding/json/encode_test.go