Go Version: go1.10
Body:
{"cat": "Sammy", "dog": "Loki"}
Target:
struct { Cat string "json:\"cat\"" }
-
pkg encoding/json (stdlib)
-
json.Unmarshal
Err:
<nil>
(interface {}) <nil>
-
json.Decoder.DisallowUnknownFields
Err:
json: unknown field "dog"
(*errors.errorString)(0xc4200a4c30)({ s: (string) (len=25) "json: unknown field \"dog\"" })
-
-
pkg github.com/json-iterator/go
-
jsoniter.ConfigCompatibleWithStandardLibrary
Err:
<nil>
(interface {}) <nil>
-
-
-
json.Unmarshal
Err:
<nil>
(interface {}) <nil>
-
json.UnmarshalMap
Err:
<nil>
(interface {}) <nil>
-
json.UnmarshalMap + jsonutil.ExtraneousFieldPaths
Err:
extraneous fields (typos?) at paths: $.dog
(*jsonutil.ExtraneousFieldsError)(0xc4200bae80)({ Paths: ([][]string) (len=1 cap=1) { ([]string) (len=1 cap=1) { (string) (len=3) "dog" } } })
-
Body:
{"cat": "sammy"}
Target:
struct { Cat struct {} "json:\"cat\"" }
-
pkg encoding/json (stdlib)
-
json.Unmarshal
Err:
json: cannot unmarshal string into Go struct field .cat of type struct {}
(*json.UnmarshalTypeError)(0xc4200be4b0)({ Value: (string) (len=6) "string", Type: (*reflect.rtype)(0x120fb20)({ size: (uintptr) <nil>, ptrdata: (uintptr) <nil>, hash: (uint32) 670477339, tflag: (reflect.tflag) 2, align: (uint8) 1, fieldAlign: (uint8) 1, kind: (uint8) 153, alg: (*reflect.typeAlg)(0x13bdd30)({ hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60, equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360 }), gcdata: (*uint8)(0x127a228)(1), str: (reflect.nameOff) 21559, ptrToThis: (reflect.typeOff) 118240 }), Offset: (int64) 15, Struct: (string) "", Field: (string) (len=3) "cat" })
-
json.Decoder.DisallowUnknownFields
Err:
json: cannot unmarshal string into Go struct field .cat of type struct {}
(*json.UnmarshalTypeError)(0xc4200be500)({ Value: (string) (len=6) "string", Type: (*reflect.rtype)(0x120fb20)({ size: (uintptr) <nil>, ptrdata: (uintptr) <nil>, hash: (uint32) 670477339, tflag: (reflect.tflag) 2, align: (uint8) 1, fieldAlign: (uint8) 1, kind: (uint8) 153, alg: (*reflect.typeAlg)(0x13bdd30)({ hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60, equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360 }), gcdata: (*uint8)(0x127a228)(1), str: (reflect.nameOff) 21559, ptrToThis: (reflect.typeOff) 118240 }), Offset: (int64) 15, Struct: (string) "", Field: (string) (len=3) "cat" })
-
-
pkg github.com/json-iterator/go
-
jsoniter.ConfigCompatibleWithStandardLibrary
Err:
struct { Cat struct {} "json:\"cat\"" }.Cat: skipObjectDecoder: expect object or null, error found in #8 byte of ...|{"cat": "sammy"}|..., bigger context ...|{"cat": "sammy"}|...
(*errors.errorString)(0xc4200a5180)({ s: (string) (len=178) "struct { Cat struct {} \"json:\\\"cat\\\"\" }.Cat: skipObjectDecoder: expect object or null, error found in #8 byte of ...|{\"cat\": \"sammy\"}|..., bigger context ...|{\"cat\": \"sammy\"}|..." })
-
-
-
json.Unmarshal
Err:
$.cat: json: cannot unmarshal string into Go struct field .cat of type struct {}
(*structurederrors.ErrorWithContext)(0xc4201381e0)({ BaseError: (*json.UnmarshalTypeError)(0xc4200be550)({ Value: (string) (len=6) "string", Type: (*reflect.rtype)(0x120fb20)({ size: (uintptr) <nil>, ptrdata: (uintptr) <nil>, hash: (uint32) 670477339, tflag: (reflect.tflag) 2, align: (uint8) 1, fieldAlign: (uint8) 1, kind: (uint8) 153, alg: (*reflect.typeAlg)(0x13bdd30)({ hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60, equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360 }), gcdata: (*uint8)(0x127a228)(1), str: (reflect.nameOff) 21559, ptrToThis: (reflect.typeOff) 118240 }), Offset: (int64) 15, Struct: (string) "", Field: (string) (len=3) "cat" }), Context: ([]string) (len=1 cap=1) { (string) (len=5) "$.cat" } })
-
json.UnmarshalMap
Err:
$.cat: json: cannot unmarshal string into Go struct field .cat of type struct {}
(*structurederrors.ErrorWithContext)(0xc4201382d0)({ BaseError: (*json.UnmarshalTypeError)(0xc4200be5a0)({ Value: (string) (len=6) "string", Type: (*reflect.rtype)(0x120fb20)({ size: (uintptr) <nil>, ptrdata: (uintptr) <nil>, hash: (uint32) 670477339, tflag: (reflect.tflag) 2, align: (uint8) 1, fieldAlign: (uint8) 1, kind: (uint8) 153, alg: (*reflect.typeAlg)(0x13bdd30)({ hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60, equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360 }), gcdata: (*uint8)(0x127a228)(1), str: (reflect.nameOff) 21559, ptrToThis: (reflect.typeOff) 118240 }), Offset: (int64) 14, Struct: (string) "", Field: (string) (len=3) "cat" }), Context: ([]string) (len=1 cap=1) { (string) (len=5) "$.cat" } })
-
json.UnmarshalMap + jsonutil.ExtraneousFieldPaths
Err:
$.cat: json: cannot unmarshal string into Go struct field .cat of type struct {}
(*structurederrors.ErrorWithContext)(0xc4201383c0)({ BaseError: (*json.UnmarshalTypeError)(0xc4200be5f0)({ Value: (string) (len=6) "string", Type: (*reflect.rtype)(0x120fb20)({ size: (uintptr) <nil>, ptrdata: (uintptr) <nil>, hash: (uint32) 670477339, tflag: (reflect.tflag) 2, align: (uint8) 1, fieldAlign: (uint8) 1, kind: (uint8) 153, alg: (*reflect.typeAlg)(0x13bdd30)({ hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60, equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360 }), gcdata: (*uint8)(0x127a228)(1), str: (reflect.nameOff) 21559, ptrToThis: (reflect.typeOff) 118240 }), Offset: (int64) 14, Struct: (string) "", Field: (string) (len=3) "cat" }), Context: ([]string) (len=1 cap=1) { (string) (len=5) "$.cat" } })
-