{"id":13741250,"url":"https://github.com/gleam-lang/json","last_synced_at":"2025-06-11T00:37:50.991Z","repository":{"id":38019810,"uuid":"442511553","full_name":"gleam-lang/json","owner":"gleam-lang","description":"🐑 Work with JSON in Gleam!","archived":false,"fork":false,"pushed_at":"2024-04-08T10:47:59.000Z","size":62,"stargazers_count":46,"open_issues_count":1,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-08T11:48:28.270Z","etag":null,"topics":["gleam","json"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/gleam_json/","language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gleam-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":["lpil"],"liberapay":"gleam"}},"created_at":"2021-12-28T15:53:16.000Z","updated_at":"2024-04-17T21:42:09.784Z","dependencies_parsed_at":"2022-09-14T00:50:21.928Z","dependency_job_id":"d91c16d9-35bb-40af-9b90-9b023f642bef","html_url":"https://github.com/gleam-lang/json","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gleam-lang","download_url":"https://codeload.github.com/gleam-lang/json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224774704,"owners_count":17367783,"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":["gleam","json"],"created_at":"2024-08-03T04:00:57.203Z","updated_at":"2025-06-11T00:37:50.983Z","avatar_url":"https://github.com/gleam-lang.png","language":"Gleam","funding_links":["https://github.com/sponsors/lpil","https://liberapay.com/gleam"],"categories":["Packages","Gleam"],"sub_categories":["JSON"],"readme":"# json 🐑\n\nWork with JSON in Gleam!\n\n## Installation\n\n```shell\ngleam add gleam_json@3\n```\n\n## Encoding\n\n```gleam\nimport myapp.{type Cat}\nimport gleam/json\n\npub fn cat_to_json(cat: Cat) -\u003e String {\n  json.object([\n    #(\"name\", json.string(cat.name)),\n    #(\"lives\", json.int(cat.lives)),\n    #(\"flaws\", json.null()),\n    #(\"nicknames\", json.array(cat.nicknames, of: json.string)),\n  ])\n  |\u003e json.to_string\n}\n```\n\n## Parsing\n\nJSON is parsed into a `Dynamic` value which can be decoded using the\n`gleam/dynamic/decode` module from the Gleam standard library.\n\n```gleam\nimport myapp.{Cat}\nimport gleam/json\nimport gleam/dynamic/decode\n\npub fn cat_from_json(json_string: String) -\u003e Result(Cat, json.DecodeError) {\n  let cat_decoder = {\n    use name \u003c- decode.field(\"name\", decode.string)\n    use lives \u003c- decode.field(\"lives\", decode.int)\n    use nicknames \u003c- decode.field(\"nicknames\", decode.list(decode.string))\n    decode.success(Cat(name:, lives:, nicknames:))\n  }\n  json.parse(from: json_string, using: cat_decoder)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgleam-lang%2Fjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgleam-lang%2Fjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgleam-lang%2Fjson/lists"}