mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
encoding/json: document and test overwrite of slice, map during Unmarshal
Fixes #8837. Change-Id: Iaaecbb0b324004cb74b16b764126b01315e6a16e Reviewed-on: https://go-review.googlesource.com/12209 Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
parent
2d25318f08
commit
749b391c55
2 changed files with 16 additions and 0 deletions
|
|
@ -48,6 +48,13 @@ import (
|
|||
// map[string]interface{}, for JSON objects
|
||||
// nil for JSON null
|
||||
//
|
||||
// To unmarshal a JSON array into a slice, Unmarshal resets the slice to nil
|
||||
// and then appends each element to the slice.
|
||||
//
|
||||
// To unmarshal a JSON object into a map, Unmarshal replaces the map
|
||||
// with an empty map and then adds key-value pairs from the object to
|
||||
// the map.
|
||||
//
|
||||
// If a JSON value is not appropriate for a given target type,
|
||||
// or if a JSON number overflows the target type, Unmarshal
|
||||
// skips that field and completes the unmarshalling as best it can.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue