]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/json: document that nil slice encodes as `null`
authorRuss Cox <rsc@golang.org>
Mon, 5 Mar 2012 18:29:22 +0000 (13:29 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 5 Mar 2012 18:29:22 +0000 (13:29 -0500)
Fixes #3189.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5730058

src/pkg/encoding/json/encode.go

index 5425a3a90a125e6ed3f31d679e87192f28ac88eb..edbafcf65f1fa6d78e6e54b49040fe049c43d7c7 100644 (file)
@@ -43,7 +43,8 @@ import (
 // to keep some browsers from misinterpreting JSON output as HTML.
 //
 // Array and slice values encode as JSON arrays, except that
-// []byte encodes as a base64-encoded string.
+// []byte encodes as a base64-encoded string, and a nil slice
+// encodes as the null JSON object.
 //
 // Struct values encode as JSON objects. Each exported struct field
 // becomes a member of the object unless