{"id":23120431,"url":"https://github.com/bel-framework/bel-json","last_synced_at":"2025-04-04T03:15:21.259Z","repository":{"id":237150703,"uuid":"793915545","full_name":"bel-framework/bel-json","owner":"bel-framework","description":"JSON encoder and decoder for OTP","archived":false,"fork":false,"pushed_at":"2024-04-30T05:38:10.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-09T14:46:54.033Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","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/bel-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-04-30T05:37:52.000Z","updated_at":"2024-04-30T05:38:14.000Z","dependencies_parsed_at":"2024-05-05T19:47:37.836Z","dependency_job_id":null,"html_url":"https://github.com/bel-framework/bel-json","commit_stats":null,"previous_names":["bel-framework/bel-json"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bel-framework","download_url":"https://codeload.github.com/bel-framework/bel-json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247112767,"owners_count":20885606,"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-12-17T06:10:21.511Z","updated_at":"2025-04-04T03:15:21.239Z","avatar_url":"https://github.com/bel-framework.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bel-framework/bel-json\n\nA JSON encoder and decoder built on top of the `json` module proposed in [EEP 68](https://www.erlang.org/eeps/eep-0068) and [introduced in OTP 27](https://www.erlang.org/news/168#highlights-for-rc2).\nUses [json_polyfill](https://github.com/williamthome/json_polyfill) to support OTP versions \u003c 27.\n\n## Encode\n\n```erlang\n1\u003e bel_json:encode(#{foo =\u003e bar}).\n\u003c\u003c\"{\\\"foo\\\":\\\"bar\\\"}\"\u003e\u003e\n```\n\n### Null\n\n```erlang\n1\u003e bel_json:encode([foo, null, undefined, bar], #{null_values =\u003e [null, undefined]}).\n\u003c\u003c\"[\\\"foo\\\",null,null,\\\"bar\\\"]\"\u003e\u003e\n```\n\n### Proplist\n\n```erlang\n1\u003e bel_json:encode([{foo, foo}, bar], #{list_codecs =\u003e [proplist]}).\n\u003c\u003c\"{\\\"foo\\\":\\\"foo\\\",\\\"bar\\\":true}\"\u003e\u003e\n```\n\n### Datetime\n\n```erlang\n1\u003e bel_json:encode([{foo, foo}, bar], #{tuple_codecs =\u003e [datetime]}).\n\u003c\u003c\"{\\\"foo\\\":\\\"2024-04-29T22:34:35Z\\\"}\"\u003e\u003e\n```\n\n### Timestamp\n\n```erlang\n1\u003e bel_json:encode({0,0,0}, #{tuple_codecs =\u003e [timestamp]}).\n\u003c\u003c\"\\\"1970-01-01T00:00:00.000Z\\\"\"\u003e\u003e\n```\n\n### IPv4\n\n```erlang\n1\u003e bel_json:encode({0,0,0,0}, #{tuple_codecs =\u003e [ipv4]}).\n\u003c\u003c\"\\\"0.0.0.0\\\"\"\u003e\u003e\n```\n\n### IPv6\n\n```erlang\n1\u003e bel_json:encode({16#fe80,0,0,0,16#204,16#acff,16#fe17,16#bf38}, #{tuple_codecs =\u003e [ipv6]}).\n\u003c\u003c\"\\\"fe80::204:acff:fe17:bf38\\\"\"\u003e\u003e\n```\n\n### Record\n\n```erlang\n% -record(foo, {foo, bar}).\n1\u003e bel_json:encode(#foo{foo = foo, bar = bar}, #{tuple_codecs =\u003e [{record, [{foo, record_info(fields, foo)}]}]}).\n\u003c\u003c\"{\\\"foo\\\":\\\"foo\\\",\\\"bar\\\":\\\"bar\\\"}\"\u003e\u003e\n```\n\n## Decode\n\n```erlang\n3\u003e bel_json:decode(\u003c\u003c\"{\\\"foo\\\":\\\"bar\\\"}\"\u003e\u003e).\n#{\u003c\u003c\"foo\"\u003e\u003e =\u003e \u003c\u003c\"bar\"\u003e\u003e}\n```\n\n## Build\n\n```shell\n$ rebar3 compile\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbel-framework%2Fbel-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbel-framework%2Fbel-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbel-framework%2Fbel-json/lists"}