aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/decode.go')
-rw-r--r--src/encoding/json/decode.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go
index 2e734fb39e..fd2bf92dc2 100644
--- a/src/encoding/json/decode.go
+++ b/src/encoding/json/decode.go
@@ -670,6 +670,7 @@ func (d *decodeState) object(v reflect.Value) error {
}
var mapElem reflect.Value
+ originalErrorContext := d.errorContext
for {
// Read opening " of string key or closing }.
@@ -829,8 +830,7 @@ func (d *decodeState) object(v reflect.Value) error {
return errPhase
}
- d.errorContext.Struct = nil
- d.errorContext.Field = ""
+ d.errorContext = originalErrorContext
}
return nil
}
@@ -988,7 +988,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
if fromQuoted {
return fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())
}
- return &UnmarshalTypeError{Value: "number", Type: v.Type(), Offset: int64(d.readIndex())}
+ d.saveError(&UnmarshalTypeError{Value: "number", Type: v.Type(), Offset: int64(d.readIndex())})
case reflect.Interface:
n, err := d.convertNumber(s)
if err != nil {