go/src/encoding
Joe Tsai 032d150bd4 encoding/json: marshal with null when RawMessage is nil
This CL expands upon a change made in (http://golang.org/cl/21811)
to ensure that a nil RawMessage gets serialized as "null" instead of
being a nil slice.

The added check only triggers when the RawMessage is nil. We do not
handle the case when the RawMessage is non-nil, but empty.

Fixes #17704
Updates #14493

Change-Id: I0fbebcdd81f7466c5b78c94953afc897f162ceb4
Reviewed-on: https://go-review.googlesource.com/32472
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-01 05:42:33 +00:00
..
ascii85 all: single space after period. 2016-03-02 00:13:47 +00:00
asn1 encoding/asn1: return error instead of dereferencing nil *big.Int in marshaling 2016-10-17 22:29:32 +00:00
base32 all: single space after period. 2016-03-02 00:13:47 +00:00
base64 encoding/base64: This change modifies Go to take strict option when decoding base64 2016-10-12 03:56:18 +00:00
binary encoding/binary: add bool support 2016-09-28 16:20:41 +00:00
csv encoding/csv: document Read error behavior 2016-10-28 19:38:12 +00:00
gob encoding/gob: error out instead of panicking on nil dereference 2016-08-19 21:54:39 +00:00
hex encoding/hex: fix example function name 2016-09-10 21:40:16 +00:00
json encoding/json: marshal with null when RawMessage is nil 2016-11-01 05:42:33 +00:00
pem encoding/pem: add Decode example 2016-10-17 14:02:33 +00:00
xml encoding/xml: add wildcard support for collecting all attributes 2016-10-18 12:59:41 +00:00
encoding.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00