mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
encoding/json: document what unmarshal of null into non-reference type does
Originally it was an error, which made perfect sense, but in issue 2540 I got talked out of this sensible behavior. I'm not thrilled with the "new" behavior but it's been there since Go 1.1 so we're stuck with it now. Fixes #6724. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/100430043
This commit is contained in:
parent
92440fb5bd
commit
fc1e5a8acd
1 changed files with 5 additions and 0 deletions
|
|
@ -54,6 +54,11 @@ import (
|
||||||
// If no more serious errors are encountered, Unmarshal returns
|
// If no more serious errors are encountered, Unmarshal returns
|
||||||
// an UnmarshalTypeError describing the earliest such error.
|
// an UnmarshalTypeError describing the earliest such error.
|
||||||
//
|
//
|
||||||
|
// The JSON null value unmarshals into an interface, map, pointer, or slice
|
||||||
|
// by setting that Go value to nil. Because null is often used in JSON to mean
|
||||||
|
// ``not present,'' unmarshaling a JSON null into any other Go type has no effect
|
||||||
|
// on the value and produces no error.
|
||||||
|
//
|
||||||
// When unmarshaling quoted strings, invalid UTF-8 or
|
// When unmarshaling quoted strings, invalid UTF-8 or
|
||||||
// invalid UTF-16 surrogate pairs are not treated as an error.
|
// invalid UTF-16 surrogate pairs are not treated as an error.
|
||||||
// Instead, they are replaced by the Unicode replacement
|
// Instead, they are replaced by the Unicode replacement
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue