{"id":13514979,"url":"https://github.com/lpil/thoas","last_synced_at":"2025-05-16T08:06:04.525Z","repository":{"id":43352608,"uuid":"235899126","full_name":"lpil/thoas","owner":"lpil","description":"A blazing fast JSON parser and generator in pure Erlang.","archived":false,"fork":false,"pushed_at":"2024-09-11T13:05:02.000Z","size":3149,"stargazers_count":167,"open_issues_count":2,"forks_count":20,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-07T02:06:31.940Z","etag":null,"topics":["erlang","json"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lpil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2020-01-23T22:26:53.000Z","updated_at":"2025-04-23T14:49:38.000Z","dependencies_parsed_at":"2023-02-12T22:30:17.541Z","dependency_job_id":"8c5847e8-6565-4620-add7-1cccffa4e749","html_url":"https://github.com/lpil/thoas","commit_stats":{"total_commits":256,"total_committers":37,"mean_commits":6.918918918918919,"dds":0.49609375,"last_synced_commit":"2b8a7a88b153fa6ee8f28e6d0f17c7e7a31189ac"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fthoas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fthoas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fthoas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fthoas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lpil","download_url":"https://codeload.github.com/lpil/thoas/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493378,"owners_count":22080126,"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":["erlang","json"],"created_at":"2024-08-01T05:01:04.823Z","updated_at":"2025-05-16T08:05:59.515Z","avatar_url":"https://github.com/lpil.png","language":"Erlang","funding_links":[],"categories":["Erlang"],"sub_categories":[],"readme":"# Thoas\n\nA blazing fast JSON parser and generator in pure Erlang.\n\nThoas is an Erlang conversion of the Elixir based [Jason library][jason]. \n\nThe parser and generator are at least twice as fast as other Elixir/Erlang\nlibraries. The performance is comparable to `jiffy`, which is implemented in C\nas a NIF. Thoas and Jason are usually only twice as slow.\n\nBoth parser and generator fully conform to\n[RFC 8259](https://tools.ietf.org/html/rfc8259) and\n[ECMA 404](https://ecma-international.org/publications-and-standards/standards/ecma-404/)\nstandards. The parser is tested using [JSONTestSuite](https://github.com/nst/JSONTestSuite).\n\nIf you like this library thank Michał and the Jason contributors. They did all\nthe hard work!\n\n## Installation\n\n### Erlang\n\n```erlang\n% rebar.config\n{deps, [thoas]}\n```\n\n### Gleam\n\n```shell\ngleam add thoas\n```\n\n### Elixir\n\n```elixir\n# mix.exs\ndef deps do\n  [{:thoas, \"~\u003e 1.0\"}]\nend\n```\n\n## Basic Usage\n\n```erlang\n\u003e JSON = thoas:encode(#{age =\u003e 44, name =\u003e \u003c\u003c\"Steve Irwin\"\u003e\u003e, nationality =\u003e \u003c\u003c\"Australian\"\u003e\u003e}).\n\u003c\u003c\"{\\\"age\\\":44,\\\"name\\\":\\\"Steve Irwin\\\",\\\"nationality\\\":\\\"Australian\\\"}\"\u003e\u003e\n\n\u003e thoas:decode(JSON).\n{ok,#{\u003c\u003c\"age\"\u003e\u003e =\u003e 44,\u003c\u003c\"name\"\u003e\u003e =\u003e \u003c\u003c\"Steve Irwin\"\u003e\u003e, \u003c\u003c\"nationality\"\u003e\u003e =\u003e \u003c\u003c\"Australian\"\u003e\u003e}}\n\n\u003e thoas:decode(JSON, #{keys =\u003e to_existing_atom}).\n{ok,#{age =\u003e 44,name =\u003e \u003c\u003c\"Steve Irwin\"\u003e\u003e, nationality =\u003e \u003c\u003c\"Australian\"\u003e\u003e}}\n```\n\n## Erlang \u003c-\u003e JSON mapping\n\nErlang                        | JSON\n------                        | ------\n`null`                        | `null`\n`true`                        | `true`\n`false`                       | `false`\n`nil`                         | `\"nil\"`\n`undefined`                   | `\"undefined\"`\n`other_atom`                  | `\"other_atom\"`\n`1`                           | `1`\n`1.1`                         | `1.1`\n`-2.0`                        | `-2.0`\n`[]`                          | `[]`\n`[1, 2]`                      | `[1,2]`\n`\"chars\"`                     | `[99,104,97,114,115]`\n`\u003c\u003c\"text\"\u003e\u003e`                  | `\"text\"`\n`\u003c\u003c\"\\n\"\u003e\u003e`                    | `\"\\\\n\"`\n`#{}`                         | `{}`\n`#{\u003c\u003c\"name\"\u003e\u003e =\u003e \u003c\u003c\"Lucy\"\u003e\u003e}` | `{\"name\":\"Lucy\"}`\n`#{score =\u003e 42, win =\u003e true}` | `{\"score\":42,\"win\":true}`\n`[{proplists, true}]`         | `{\"proplists\":true}`\n\n\n## Benchmarks\n\nBenchmarks against most popular Elixir \u0026 Erlang json libraries can be executed after\ngoing into the `bench/` folder and then executing `mix bench.encode` and `mix bench.decode`.\nA HTML report of the benchmarks (after their execution) can be found in\n`bench/output/encode.html` and `bench/output/decode.html` respectively.\n\n## Differences to Jason\n\nThoas has some feature differences compared to Jason.\n\n- Thoas is written in Erlang.\n- Thoas has no support for Elixir protocols.\n- Thoas has no support for pretty-printing JSON.\n- Thoas has no support for detecting duplicate object keys.\n- Thoas has no support for decoding objects to ordered dictionaries.\n- Thoas has no support for decoding floats to Elixir decimals.\n- Thoas has an additional non-recursive encoder API that may be useful when\n  working within statically typed languages such as Gleam.\n\n## Why not use Jason?\n\nJason rocks, but if you're writing Erlang, Gleam, or some other BEAM language\nyou probably don't want to pull in the Elixir compiler and their standard\nlibraries just to get a really fast JSON parser. Thoas is just Erlang and uses\nrebar3, so it can be easily added as a dependency to projects written in any\nBEAM language.\n\nThoas also has a non-recursive API that may be useful from statically typed\nlanguages or in highly performance constrained scenarios.\n\n## Why is it called Thoas?\n\nThoas is [a son of Jason](https://en.wikipedia.org/wiki/Thoas_(son_of_Jason)).\n\n## License\n\nThoas is released under the Apache License 2.0 - see the [LICENSE](LICENSE) file.\n\nThoas is based off of [Jason][jason], which is also Apache 2.0 licenced.\n\nSome elements of tests and benchmarks have their origins in the\n[Poison library](https://github.com/devinus/poison) and were initially licensed under [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/).\n\n[jason]: https://github.com/michalmuskala/jason\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpil%2Fthoas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flpil%2Fthoas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpil%2Fthoas/lists"}