File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLD
99github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 /go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0 =
1010github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
1111github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
12+ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4 =
1213github.com/stretchr/objx v0.1.0 /go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME =
1314github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q =
1415github.com/stretchr/testify v1.3.0 /go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI =
Original file line number Diff line number Diff line change @@ -1075,6 +1075,11 @@ type stringModeNumberDecoder struct {
10751075}
10761076
10771077func (decoder * stringModeNumberDecoder ) Decode (ptr unsafe.Pointer , iter * Iterator ) {
1078+ if iter .WhatIsNext () == NilValue {
1079+ decoder .elemDecoder .Decode (ptr , iter )
1080+ return
1081+ }
1082+
10781083 c := iter .nextToken ()
10791084 if c != '"' {
10801085 iter .ReportError ("stringModeNumberDecoder" , `expect ", but found ` + string ([]byte {c }))
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ func init() {
2626 Field int `json:"field"`
2727 })(nil ),
2828 input : `{"field": null}` ,
29+ }, unmarshalCase {
30+ ptr : (* struct {
31+ Field int `json:"field,string"`
32+ })(nil ),
33+ input : `{"field": null}` ,
2934 }, unmarshalCase {
3035 ptr : (* struct {
3136 ID int `json:"id"`
You can’t perform that action at this time.
0 commit comments