diff options
| author | Paul Borman <borman@google.com> | 2013-07-11 22:34:09 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-07-11 22:34:09 -0400 |
| commit | 59306493067a6ebcc50bc9dfd4a1d1af543bd2d8 (patch) | |
| tree | 80b509297f44ab23682b9f48035ebdd1bb44d45c /src/pkg/encoding/json/encode.go | |
| parent | 09e72f5670664539a4f01c60faea4a366d2a0fb8 (diff) | |
| download | go-59306493067a6ebcc50bc9dfd4a1d1af543bd2d8.tar.xz | |
json: unmarshal types that are byte slices.
The json package cheerfully would marshal
type S struct {
IP net.IP
}
but would give an error when unmarshalling. This change allows any
type whose concrete type is a byte slice to be unmarshalled from a
string.
Fixes #5086.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11161044
Diffstat (limited to 'src/pkg/encoding/json/encode.go')
| -rw-r--r-- | src/pkg/encoding/json/encode.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/encoding/json/encode.go b/src/pkg/encoding/json/encode.go index ffe903a546..e25a9b8805 100644 --- a/src/pkg/encoding/json/encode.go +++ b/src/pkg/encoding/json/encode.go @@ -44,8 +44,8 @@ import ( // The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" // 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, and a nil slice +// Array and slice values encode as JSON arrays, except that a slice of +// bytes 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 |
