{"id":26061682,"url":"https://github.com/d3rty/json","last_synced_at":"2026-04-22T10:33:28.173Z","repository":{"id":279126445,"uuid":"937793621","full_name":"d3rty/json","owner":"d3rty","description":"Flexible JSON decoding for Go — gracefully handling schema variations and forgiving mistakes.","archived":false,"fork":false,"pushed_at":"2026-02-23T21:47:45.000Z","size":2316,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-24T04:30:05.860Z","etag":null,"topics":["dirty-data","json-parser","json-schema","sanitizer","validator"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d3rty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-23T22:33:50.000Z","updated_at":"2026-02-23T21:47:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"62e612d9-4688-4529-b22e-0a3ad2ecc858","html_url":"https://github.com/d3rty/json","commit_stats":null,"previous_names":["d3rty/json"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/d3rty/json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3rty%2Fjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3rty%2Fjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3rty%2Fjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3rty%2Fjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d3rty","download_url":"https://codeload.github.com/d3rty/json/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3rty%2Fjson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32132459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T08:34:57.708Z","status":"ssl_error","status_checked_at":"2026-04-22T08:34:55.583Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dirty-data","json-parser","json-schema","sanitizer","validator"],"created_at":"2025-03-08T15:13:06.490Z","updated_at":"2026-04-22T10:33:28.168Z","avatar_url":"https://github.com/d3rty.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# d3rty/json 🧼\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" alt=\"Logo\" width=\"300\"/\u003e\u003cbr\u003e\n\u003c/p\u003e\n\u003ch3 align=\"center\"\u003eFlexible JSON unmarshalling for Go:\u003c/h3\u003e\n\u003ch4 align=\"center\"\u003e\u003cem\u003eGracefully handling schema variations and forgiving mistakes.\u003c/em\u003e\u003c/h4\u003e\n\n\n\n\u003e 🚧 Project is a `Work In Progress` thing.\n\n## Overview\n\n**d3rty/json** is a robust Go library for parsing JSON data from third-party sources you can’t fully control or trust.\nIt’s built to handle real-world, unpredictable JSON — whether you're dealing with schema flakiness like stringified integers,\ninconsistent key naming (camelCase vs. snake_keys), or even quirks introduced by AI-generated data.\nWith a forgiving approach to unmarshalling, d3rty/json ensures your application continues to work reliably while still capturing\nas much meaningful data as possible.\n\n## Key Features\n\n- **Flexible Unmarshalling:**\u003cbr\u003e\n  Attempts standard decoding first and then gracefully falls back to a more flexible decoding when encountering schema variations.\n\n- **Custom Data Types:**\u003cbr\u003e\n  Provides custom types (such as `Number`, `String`, `Bool`, `Array`, and `Object`) that are designed to interpret JSON values even when they deviate from the standard.\n\n- **Seamless Integration:**\u003cbr\u003e\n  Designed to work as a drop-in replacement for the standard library’s `json.Unmarshal`, `json.NewDecoder` allowing you to easily switch without rewriting your models.\n\n- **Error \u0026 Warning Reporting: 🚧 NOT IMPLEMENTED 🚧**\u003cbr\u003e\n  Incorporates a system of result colors (🟢 Green, 🟡 Yellow, 🔴 Red) to signal the quality of the unmarshalling process—whether it was clean, achieved through forgiving conversions, or partially lossy.\n\n## Installation\n\nAfter `go get github.com/d3rty/json` you can simply import the package into your code:\n\n```go\nimport \"github.com/d3rty/json\"\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n\n    dirty \"github.com/d3rty/json\"\n)\n\n// Event is a classical \"clean\" model.\n// Types are strict.\ntype Event struct {\n    dirty.Enabled // Enables dirty unmarshalling.\n\n    Name   string `json:\"name\"`\n\n    // These fields will be rewritten in dirty schema.\n    // In case if they were dirty-read (stringified integers, etc.) - they are still valid. (Yellow Mode)\n    ID       int    `json:\"id\"`\n    IsActive bool   `json:\"is_active\"` // this will be read as is_active/IsActive/is-active, etc.\n\n    // MustBool won't be rewritten in dirty schema. So this field MUST be bool or ignored (Red Mode).\n    MustBool bool `json:\"must_bool\"`\n}\n\n// Dirty method links the clean model to its dirty variant.\nfunc (e *Event) Dirty() any {\n    // Both inline or defined type work here.\n    return \u0026struct {\n      ID       dirty.Number `json:\"id\"`\n      IsActive dirty.Bool   `json:\"is_active\"`\n    }{}\n}\n\nfunc main() {\n    // No data loss, we forgave all the mistakes:\n    data := []byte(`{\"id\": \"123\", \"name\": \"Sample Event\", \"IsActive\": \"on\", \"must_bool\": true}`)\n    var event Event\n\n    if err := dirty.Unmarshal(data, \u0026event); err != nil {\n      log.Fatalf(\"error unmarshalling: %v\", err)\n    }\n\n    // We successfully marshaled, fixing all the mistakes that we forgave (Yellow mode):\n    fmt.Println(event.ID) // 123\n    fmt.Println(event.IsActive) // true\n    fmt.Println(event.MustBool) // true\n\n    // Unparsable value on the strict (clean) field:\n    // We couldn't fix all the mistakes, so we lost the data (Red mode):\n    data = []byte(`{\"id\": \"123\", \"name\": \"Sample Event\", \"IsActive\": \"on\", \"must_bool\": \"true\"}`)\n\n    event = Event{}\n    if err := dirty.Unmarshal(data, \u0026event); err != nil {\n      log.Fatalf(\"error unmarshalling: %v\", err)\n    }\n\n    fmt.Println(event.ID) // 123\n    fmt.Println(event.IsActive) // true\n    fmt.Println(event.MustBool) // false (Because it's not declared in a dirty scheme)\n}\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3rty%2Fjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd3rty%2Fjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3rty%2Fjson/lists"}