]> Cypherpunks repositories - gostls13.git/commit
json: unmarshal types that are byte slices.
authorPaul Borman <borman@google.com>
Fri, 12 Jul 2013 02:34:09 +0000 (22:34 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 12 Jul 2013 02:34:09 +0000 (22:34 -0400)
commit59306493067a6ebcc50bc9dfd4a1d1af543bd2d8
tree80b509297f44ab23682b9f48035ebdd1bb44d45c
parent09e72f5670664539a4f01c60faea4a366d2a0fb8
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
src/pkg/encoding/json/decode.go
src/pkg/encoding/json/decode_test.go
src/pkg/encoding/json/encode.go