{"id":13508427,"url":"https://github.com/guedes/exjson","last_synced_at":"2025-04-11T12:53:20.134Z","repository":{"id":2959603,"uuid":"3974038","full_name":"guedes/exjson","owner":"guedes","description":"JSON parser and genarator in Elixir.","archived":false,"fork":false,"pushed_at":"2016-08-23T15:00:05.000Z","size":96,"stargazers_count":71,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T09:11:44.649Z","etag":null,"topics":["elixir","json","parse"],"latest_commit_sha":null,"homepage":"","language":"Erlang","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/guedes.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}},"created_at":"2012-04-09T17:41:41.000Z","updated_at":"2021-05-25T18:06:33.000Z","dependencies_parsed_at":"2022-08-30T23:01:17.612Z","dependency_job_id":null,"html_url":"https://github.com/guedes/exjson","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedes%2Fexjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedes%2Fexjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedes%2Fexjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedes%2Fexjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guedes","download_url":"https://codeload.github.com/guedes/exjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248403512,"owners_count":21097525,"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":["elixir","json","parse"],"created_at":"2024-08-01T02:00:52.895Z","updated_at":"2025-04-11T12:53:20.111Z","avatar_url":"https://github.com/guedes.png","language":"Erlang","funding_links":[],"categories":["JSON"],"sub_categories":[],"readme":"JSON for Elixir\n===============\n\n[Elixir](http://elixir-lang.org) implementation (with an Erlang parser) of the [JSON](http://www.json.org) specification to [RFC 4627](http://www.ietf.org/rfc/rfc4627.txt). ExJSON generate JSON string from keyword lists and maps and can parse into those structures also.\n\n## Installation\n\nAdd HTTPoison to your `mix.exs` dependencies:\n\n```elixir\ndef deps do\n  [{:exjson, \"~\u003e 0.6.0\"}]\nend\n```\n\nand run `$ mix deps.get`.\n\n## Generating a JSON string from a keyword list\n\n```elixir\n ExJSON.generate([ key: \"some value\" ])\n #=\u003e \"{\\\"key\\\":\\\"some value\\\"}\"\n\n ExJSON.generate([ k: [ 1, 2, 3 ] ])\n #=\u003e \"{\\\"k\\\":[1,2,3]}\"\n\n ExJSON.generate([ k1: [ k2: [ k3: \"v3\" ] ] ])\n #=\u003e \"{\\\"k1\\\":{\\\"k2\\\":{\\\"k3\\\":\\\"v3\\\"}}}\"\n\n ExJSON.generate([\n    image: [\n      width: 800,\n      height: 600,\n      title: \"View from 15th Floor\",\n      thumbnail: [\n        url: \"http://www.example.com/image/481989943\",\n        height: 125,\n        width: 100\n      ],\n      ids: [ 116, 943, 234, 38793 ]\n    ]\n ])\n #=\u003e \"{\\\"image\\\":{\\\"height\\\":600,\\\"ids\\\":[116,943,234,38793],\\\"thumbnail\\\":{\\\"height\\\":125,\\\"url\\\":\\\"http://www.example.com/image/481989943\\\",\\\"width\\\":100},\\\"title\\\":\\\"View from 15th Floor\\\",\\\"width\\\":800}}\"\n```\n## Generating a JSON string from a map\n\n```elixir\n ExJSON.generate(%{\n  location: %{\n    lat: -47.8,\n    lng:  23.8\n  },\n  name: \"The name\",\n  phone: \"666-6666\",\n  urls: [\n   \"http://example1.org\",\n   \"http://example2.org\"\n  ]\n })\n #=\u003e \"{\\\"location\\\":{\\\"lat\\\":-47.8,\\\"lng\\\":23.8},\\\"name\\\":\\\"The name\\\",\\\"phone\\\":\\\"666-6666\\\",\\\"urls\\\":[\\\"http://example1.org\\\",\\\"http://example2.org\\\"]}\"\n```\n\n## Parsing JSON string to keyword list\n\n```elixir\n ExJSON.parse(\n '{\n   \"key\": \"value\",\n   \"another_key\": {\n     \"k1\": \"v1\",\n     \"k2\": \"v2\",\n     \"k3\": \"v3\"\n   }\n }')\n #=\u003e [ { \"key\", \"value\" }, { \"another_key\", [ { \"k1\", \"v1\" }, { \"k2\", \"v2\" }, { \"k3\", \"v3\" } ] } ]\n\n ExJSON.parse(\n '{\n    \"key\": \"some value\",\n    \"another_key\": [ \"value1\", \"another value\", \"value 3\" ],\n    \"nested_key\": {\n      \"inside_key\": \"a value\",\n      \"bool_value1\": true,\n      \"bool_value2\": false,\n      \"nil_value\": null\n    },\n    \"tags\": [ \"test1\", \"test2\", \"test3\" ]\n }')\n #=\u003e [ { \"key\", \"some value\" }, { \"another_key\", [ \"value1\", \"another value\", \"value 3\" ] }, { \"nested_key\", [ { \"inside_key\", \"a value\" }, { \"bool_value1\", true }, { \"bool_value2\", false }, { \"nil_value\", nil } ] }, { \"tags\", [ \"test1\", \"test2\", \"test3\" ] } ]\n```\n\n## Parsing JSON string to map\n\n```elixir\n ExJSON.parse('{\n  \"location\": {\n    \"lat\": -47.8,\n    \"lng\": 23.8\n  },\n  \"name\": \"The name\",\n  \"phone\": \"666-6666\",\n  \"urls\": [\n    \"http://example1.org\",\n    \"http://example2.org\"\n  ]\n }', :to_map)\n #=\u003e %{\"location\" =\u003e %{\"lat\" =\u003e -47.8, \"lng\" =\u003e 23.8}, \"name\" =\u003e \"The name\", \"phone\" =\u003e \"666-6666\", \"urls\" =\u003e [\"http://example1.org\", \"http://example2.org\"]}\n```\n\n## License\n\nCopyright 2012,2013,2014 Dickson S. Guedes.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguedes%2Fexjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguedes%2Fexjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguedes%2Fexjson/lists"}