{"id":21962722,"url":"https://github.com/icio/jsonerrors","last_synced_at":"2026-05-02T10:35:20.766Z","repository":{"id":143094856,"uuid":"136405141","full_name":"icio/jsonerrors","owner":"icio","description":null,"archived":false,"fork":false,"pushed_at":"2018-06-07T01:43:26.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T00:43:22.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-07T01:29:39.000Z","updated_at":"2018-06-07T01:43:28.000Z","dependencies_parsed_at":"2023-04-27T21:47:03.787Z","dependency_job_id":null,"html_url":"https://github.com/icio/jsonerrors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icio%2Fjsonerrors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icio%2Fjsonerrors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icio%2Fjsonerrors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icio%2Fjsonerrors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icio","download_url":"https://codeload.github.com/icio/jsonerrors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245020314,"owners_count":20548156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T10:54:08.939Z","updated_at":"2026-05-02T10:35:15.744Z","avatar_url":"https://github.com/icio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go JSON Parsers: Errors\n\nGo Version: go1.10\n\n\n## Test: Unknown object property.\n\nBody:\n```json\n{\"cat\": \"Sammy\", \"dog\": \"Loki\"}\n```\nTarget:\n```go\nstruct { Cat string \"json:\\\"cat\\\"\" }\n```\n\n\n* **pkg [encoding/json](https://godoc.org/encoding/json)**  (stdlib)\n\n\n\t* **json.Unmarshal**\n\n\t  Err: `\u003cnil\u003e`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(interface {}) \u003cnil\u003e\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\t* **json.Decoder.DisallowUnknownFields**\n\n\t  Err: `json: unknown field \"dog\"`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*errors.errorString)(0xc4200a4c30)({\n\t\t  s: (string) (len=25) \"json: unknown field \\\"dog\\\"\"\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\n* **pkg [github.com/json-iterator/go](https://godoc.org/github.com/json-iterator/go)** \n\n\n\t* **jsoniter.ConfigCompatibleWithStandardLibrary**\n\n\t  Err: `\u003cnil\u003e`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(interface {}) \u003cnil\u003e\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\n* **pkg [github.com/koki/json](https://godoc.org/github.com/koki/json)** \n\n\n\t* **json.Unmarshal**\n\n\t  Err: `\u003cnil\u003e`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(interface {}) \u003cnil\u003e\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\t* **json.UnmarshalMap**\n\n\t  Err: `\u003cnil\u003e`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(interface {}) \u003cnil\u003e\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\t* **json.UnmarshalMap + jsonutil.ExtraneousFieldPaths**\n\n\t  Err: `extraneous fields (typos?) at paths: $.dog`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*jsonutil.ExtraneousFieldsError)(0xc4200bae80)({\n\t\t  Paths: ([][]string) (len=1 cap=1) {\n\t\t    ([]string) (len=1 cap=1) {\n\t\t      (string) (len=3) \"dog\"\n\t\t    }\n\t\t  }\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\n\n## Test: Using a string instead of an object.\n\nBody:\n```json\n{\"cat\": \"sammy\"}\n```\nTarget:\n```go\nstruct { Cat struct {} \"json:\\\"cat\\\"\" }\n```\n\n\n* **pkg [encoding/json](https://godoc.org/encoding/json)**  (stdlib)\n\n\n\t* **json.Unmarshal**\n\n\t  Err: `json: cannot unmarshal string into Go struct field .cat of type struct {}`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*json.UnmarshalTypeError)(0xc4200be4b0)({\n\t\t  Value: (string) (len=6) \"string\",\n\t\t  Type: (*reflect.rtype)(0x120fb20)({\n\t\t    size: (uintptr) \u003cnil\u003e,\n\t\t    ptrdata: (uintptr) \u003cnil\u003e,\n\t\t    hash: (uint32) 670477339,\n\t\t    tflag: (reflect.tflag) 2,\n\t\t    align: (uint8) 1,\n\t\t    fieldAlign: (uint8) 1,\n\t\t    kind: (uint8) 153,\n\t\t    alg: (*reflect.typeAlg)(0x13bdd30)({\n\t\t      hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60,\n\t\t      equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360\n\t\t    }),\n\t\t    gcdata: (*uint8)(0x127a228)(1),\n\t\t    str: (reflect.nameOff) 21559,\n\t\t    ptrToThis: (reflect.typeOff) 118240\n\t\t  }),\n\t\t  Offset: (int64) 15,\n\t\t  Struct: (string) \"\",\n\t\t  Field: (string) (len=3) \"cat\"\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\t* **json.Decoder.DisallowUnknownFields**\n\n\t  Err: `json: cannot unmarshal string into Go struct field .cat of type struct {}`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*json.UnmarshalTypeError)(0xc4200be500)({\n\t\t  Value: (string) (len=6) \"string\",\n\t\t  Type: (*reflect.rtype)(0x120fb20)({\n\t\t    size: (uintptr) \u003cnil\u003e,\n\t\t    ptrdata: (uintptr) \u003cnil\u003e,\n\t\t    hash: (uint32) 670477339,\n\t\t    tflag: (reflect.tflag) 2,\n\t\t    align: (uint8) 1,\n\t\t    fieldAlign: (uint8) 1,\n\t\t    kind: (uint8) 153,\n\t\t    alg: (*reflect.typeAlg)(0x13bdd30)({\n\t\t      hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60,\n\t\t      equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360\n\t\t    }),\n\t\t    gcdata: (*uint8)(0x127a228)(1),\n\t\t    str: (reflect.nameOff) 21559,\n\t\t    ptrToThis: (reflect.typeOff) 118240\n\t\t  }),\n\t\t  Offset: (int64) 15,\n\t\t  Struct: (string) \"\",\n\t\t  Field: (string) (len=3) \"cat\"\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\n* **pkg [github.com/json-iterator/go](https://godoc.org/github.com/json-iterator/go)** \n\n\n\t* **jsoniter.ConfigCompatibleWithStandardLibrary**\n\n\t  Err: `struct { Cat struct {} \"json:\\\"cat\\\"\" }.Cat: skipObjectDecoder: expect object or null, error found in #8 byte of ...|{\"cat\": \"sammy\"}|..., bigger context ...|{\"cat\": \"sammy\"}|...`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*errors.errorString)(0xc4200a5180)({\n\t\t  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\\\"}|...\"\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\n* **pkg [github.com/koki/json](https://godoc.org/github.com/koki/json)** \n\n\n\t* **json.Unmarshal**\n\n\t  Err: `$.cat: json: cannot unmarshal string into Go struct field .cat of type struct {}`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*structurederrors.ErrorWithContext)(0xc4201381e0)({\n\t\t  BaseError: (*json.UnmarshalTypeError)(0xc4200be550)({\n\t\t    Value: (string) (len=6) \"string\",\n\t\t    Type: (*reflect.rtype)(0x120fb20)({\n\t\t      size: (uintptr) \u003cnil\u003e,\n\t\t      ptrdata: (uintptr) \u003cnil\u003e,\n\t\t      hash: (uint32) 670477339,\n\t\t      tflag: (reflect.tflag) 2,\n\t\t      align: (uint8) 1,\n\t\t      fieldAlign: (uint8) 1,\n\t\t      kind: (uint8) 153,\n\t\t      alg: (*reflect.typeAlg)(0x13bdd30)({\n\t\t        hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60,\n\t\t        equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360\n\t\t      }),\n\t\t      gcdata: (*uint8)(0x127a228)(1),\n\t\t      str: (reflect.nameOff) 21559,\n\t\t      ptrToThis: (reflect.typeOff) 118240\n\t\t    }),\n\t\t    Offset: (int64) 15,\n\t\t    Struct: (string) \"\",\n\t\t    Field: (string) (len=3) \"cat\"\n\t\t  }),\n\t\t  Context: ([]string) (len=1 cap=1) {\n\t\t    (string) (len=5) \"$.cat\"\n\t\t  }\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\t* **json.UnmarshalMap**\n\n\t  Err: `$.cat: json: cannot unmarshal string into Go struct field .cat of type struct {}`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*structurederrors.ErrorWithContext)(0xc4201382d0)({\n\t\t  BaseError: (*json.UnmarshalTypeError)(0xc4200be5a0)({\n\t\t    Value: (string) (len=6) \"string\",\n\t\t    Type: (*reflect.rtype)(0x120fb20)({\n\t\t      size: (uintptr) \u003cnil\u003e,\n\t\t      ptrdata: (uintptr) \u003cnil\u003e,\n\t\t      hash: (uint32) 670477339,\n\t\t      tflag: (reflect.tflag) 2,\n\t\t      align: (uint8) 1,\n\t\t      fieldAlign: (uint8) 1,\n\t\t      kind: (uint8) 153,\n\t\t      alg: (*reflect.typeAlg)(0x13bdd30)({\n\t\t        hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60,\n\t\t        equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360\n\t\t      }),\n\t\t      gcdata: (*uint8)(0x127a228)(1),\n\t\t      str: (reflect.nameOff) 21559,\n\t\t      ptrToThis: (reflect.typeOff) 118240\n\t\t    }),\n\t\t    Offset: (int64) 14,\n\t\t    Struct: (string) \"\",\n\t\t    Field: (string) (len=3) \"cat\"\n\t\t  }),\n\t\t  Context: ([]string) (len=1 cap=1) {\n\t\t    (string) (len=5) \"$.cat\"\n\t\t  }\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\t* **json.UnmarshalMap + jsonutil.ExtraneousFieldPaths**\n\n\t  Err: `$.cat: json: cannot unmarshal string into Go struct field .cat of type struct {}`\n\n\t\t\u003cdetails\u003e\n\t\t\n\t\t```go\n\t\t(*structurederrors.ErrorWithContext)(0xc4201383c0)({\n\t\t  BaseError: (*json.UnmarshalTypeError)(0xc4200be5f0)({\n\t\t    Value: (string) (len=6) \"string\",\n\t\t    Type: (*reflect.rtype)(0x120fb20)({\n\t\t      size: (uintptr) \u003cnil\u003e,\n\t\t      ptrdata: (uintptr) \u003cnil\u003e,\n\t\t      hash: (uint32) 670477339,\n\t\t      tflag: (reflect.tflag) 2,\n\t\t      align: (uint8) 1,\n\t\t      fieldAlign: (uint8) 1,\n\t\t      kind: (uint8) 153,\n\t\t      alg: (*reflect.typeAlg)(0x13bdd30)({\n\t\t        hash: (func(unsafe.Pointer, uintptr) uintptr) 0x1001b60,\n\t\t        equal: (func(unsafe.Pointer, unsafe.Pointer) bool) 0x1002360\n\t\t      }),\n\t\t      gcdata: (*uint8)(0x127a228)(1),\n\t\t      str: (reflect.nameOff) 21559,\n\t\t      ptrToThis: (reflect.typeOff) 118240\n\t\t    }),\n\t\t    Offset: (int64) 14,\n\t\t    Struct: (string) \"\",\n\t\t    Field: (string) (len=3) \"cat\"\n\t\t  }),\n\t\t  Context: ([]string) (len=1 cap=1) {\n\t\t    (string) (len=5) \"$.cat\"\n\t\t  }\n\t\t})\n\t\t```\n\t\t\n\t\t\u003c/details\u003e\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficio%2Fjsonerrors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficio%2Fjsonerrors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficio%2Fjsonerrors/lists"}