From: Russ Cox Date: Mon, 5 Mar 2012 18:29:22 +0000 (-0500) Subject: encoding/json: document that nil slice encodes as `null` X-Git-Tag: weekly.2012-03-13~233 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8dbd9d746d9dc8a03bdbc77eb9db23c6a46e054d;p=gostls13.git encoding/json: document that nil slice encodes as `null` Fixes #3189. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5730058 --- diff --git a/src/pkg/encoding/json/encode.go b/src/pkg/encoding/json/encode.go index 5425a3a90a..edbafcf65f 100644 --- a/src/pkg/encoding/json/encode.go +++ b/src/pkg/encoding/json/encode.go @@ -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