1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:04:41 -07:00

encoding/json: document that nil slice encodes as null

Fixes #3189.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5730058
This commit is contained in:
Russ Cox 2012-03-05 13:29:22 -05:00
parent 8e5b34e580
commit 8dbd9d746d

View File

@ -43,7 +43,8 @@ import (
// to keep some browsers from misinterpreting JSON output as HTML. // to keep some browsers from misinterpreting JSON output as HTML.
// //
// Array and slice values encode as JSON arrays, except that // 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 // Struct values encode as JSON objects. Each exported struct field
// becomes a member of the object unless // becomes a member of the object unless