{"id":15801239,"url":"https://github.com/char0n/json-parsers","last_synced_at":"2026-01-20T21:33:30.863Z","repository":{"id":37040829,"uuid":"281052155","full_name":"char0n/json-parsers","owner":"char0n","description":"Monorepo containing research for various json-parsers","archived":false,"fork":false,"pushed_at":"2023-07-18T22:56:29.000Z","size":80,"stargazers_count":3,"open_issues_count":8,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-06T01:21:45.199Z","etag":null,"topics":["javascript","json","parser"],"latest_commit_sha":null,"homepage":"https://github.com/char0n/json-parsers","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/char0n.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}},"created_at":"2020-07-20T07:56:11.000Z","updated_at":"2023-03-30T11:18:23.000Z","dependencies_parsed_at":"2024-10-26T15:39:21.449Z","dependency_job_id":null,"html_url":"https://github.com/char0n/json-parsers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/char0n/json-parsers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/char0n%2Fjson-parsers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/char0n%2Fjson-parsers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/char0n%2Fjson-parsers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/char0n%2Fjson-parsers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/char0n","download_url":"https://codeload.github.com/char0n/json-parsers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/char0n%2Fjson-parsers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28614611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T18:56:40.769Z","status":"ssl_error","status_checked_at":"2026-01-20T18:54:26.653Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["javascript","json","parser"],"created_at":"2024-10-05T01:21:26.312Z","updated_at":"2026-01-20T21:33:30.848Z","avatar_url":"https://github.com/char0n.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript JSON parsers\nMonorepo containing research for various JSON parsers for JavaSript.\n\n### Requirements\n\nI consider quality JSON parser to support **source maps** and implements **error recovery** mechanism.\n\nThis is the list of researched JSON parsers. Clicking on specific json parser\nwill lead you to specific research whitepaper of that particular parser.\n\n- [json-ast](./packages/json-ast)\n- [json-source-map](./packages/json-source-map)\n- [jsonc-parser](./packages/jsonc-parser)\n- [json-to-ast](./packages/json-to-ast)\n- [json-asty](./packages/json-asty)\n- [tree-sitter](./packages/tree-sitter)\n- [Chevrotain](./packages/chevrotain)\n- [Antlr4](./packages/antlr4)\n- [nearley](./packages/nearley)\n\n### Other JSON parser\n\nThis list contains parsers that seemed worth analyzing but after initial analysis\nlacked features I'd expect from the proper parser:\n\n - [parsimmon](https://github.com/jneen/parsimmon) - very primitive, no location, nor error recovery mechanism\n - [Hand-build parser](https://github.com/sap/chevrotain/blob/gh-pages/performance/jsonParsers/handbuilt/handbuilt.js)\n - [PEG.js](https://github.com/pegjs/pegjs) - no advanced JSON grammar available (no location, no error recovery)\n - [jison](https://github.com/zaach/jison) - seems dead (no commits for 3 years), error recovery in alpha mode\n - [nyma](https://www.npmjs.com/package/myna-parser) - usage in community is minimal, documentation consist of 1 A4 document\n - [ohm.js](https://github.com/harc/ohm) - sparse documentation, no release in 2 years, no mention about error recovery mechanism\n\n### Summary\n\nThis section describes candidates of JSON parsers that got into final selection.\nThe order that the libraries are mentioned in doesn't express any preference.\n\nOne of the most interesting parsers (not a parser generator) that I've researched here is [jsonc-parser](./packages/jsonc-parser) developed by [Microsoft](https://www.microsoft.com/).\nIt's really a piece of art, with no dependencies, advanced error recovery mechanism and source maps support.\nIt also goes beyond the JSON spec and optionally supports JS comments and trailing commas. Contains\nAPI for incremental parsing and edits.\n\nThe rest of the parsers that got into this selection falls into categories of true [parser generators](https://en.wikipedia.org/wiki/Compiler-compiler).\n[tree-sitter](./packages/tree-sitter), [Chevrotain](./packages/chevrotain) and [Antlr4](./packages/antlr4) are\non the same level feature-vise.\n\n*Chevrotain* seems like most configurable one, allowing switching the\nfault tolerance/error recovery mechanism on and off, along with optional parsing of comments and switching\nbetween [CST and AST trees](https://sap.github.io/chevrotain/docs/guide/concrete_syntax_tree.html#ast-vs-cst).\nIt's also the fastest (JavaScript) parser generator out there.\n\n*Antlr4* is a very mature library with JavaScript runtime, considered a second fastest out there.\nIt's masterfully documented and there is an actual [book](https://www.oreilly.com/library/view/the-definitive-antlr/9781941222621/)\nwritten about it. Error recovery strategies can be altered.\n\n*tree-sitter* supports incremental parsing, AST updates and has one of the most sophisticated\nerror recovery mechanism out there. The library is super fast as is written in C and can be used\nvia node.js bindings or [WASM](https://webassembly.org/). The biggest thing about this library\nis that [Github uses it to highlight all it's code](https://github.blog/2018-10-31-atoms-new-parsing-system/) and\n[Atom editor](https://atom.io/) uses it as well. Error recovery mechanism cannot be turned off by a configuration.\n\n### Additional resources\n\n - [Implementing custom JSON parser from scratch](https://lihautan.com/json-parser-with-javascript/)\n - [Backus-Naur Form](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form)\n - [McKeeman Form](https://www.crockford.com/mckeeman.html)\n - [Parsing absolutely anything in JavaScript using Earley algorithm](https://medium.com/@gajus/parsing-absolutely-anything-in-javascript-using-earley-algorithm-886edcc31e5e)\n - [Error Detection and Recovery in LR Parsers](http://what-when-how.com/compiler-writing/bottom-up-parsing-compiler-writing-part-13/)\n - [Error Recovery for LR Parsers](http://www.dtic.mil/dtic/tr/fulltext/u2/a043470.pdf)\n - [JavaScript Parsing Libraries Benchmark](https://sap.github.io/chevrotain/performance/)\n - [Comparison of parser generators](https://en.wikipedia.org/wiki/Comparison_of_parser_generators)\n - [Efficient and Flexible Incremental Parsing](https://www.researchgate.net/publication/2377179_Efficient_and_Flexible_Incremental_Parsing)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchar0n%2Fjson-parsers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchar0n%2Fjson-parsers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchar0n%2Fjson-parsers/lists"}