{"id":31723555,"url":"https://github.com/leoz0214/json-parser","last_synced_at":"2026-06-19T23:31:46.790Z","repository":{"id":233201727,"uuid":"785935839","full_name":"leoz0214/JSON-Parser","owner":"leoz0214","description":"A small C++ library to convert a JSON string or file into polymorphic C++ objects.","archived":false,"fork":false,"pushed_at":"2024-04-28T21:34:36.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T04:57:08.319Z","etag":null,"topics":["cpp","json","parser"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leoz0214.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-13T00:24:21.000Z","updated_at":"2024-04-28T21:35:52.000Z","dependencies_parsed_at":"2024-04-19T11:02:32.127Z","dependency_job_id":null,"html_url":"https://github.com/leoz0214/JSON-Parser","commit_stats":null,"previous_names":["leoz0214/json-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leoz0214/JSON-Parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoz0214%2FJSON-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoz0214%2FJSON-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoz0214%2FJSON-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoz0214%2FJSON-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leoz0214","download_url":"https://codeload.github.com/leoz0214/JSON-Parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoz0214%2FJSON-Parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34552295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cpp","json","parser"],"created_at":"2025-10-09T04:57:02.210Z","updated_at":"2026-06-19T23:31:46.774Z","avatar_url":"https://github.com/leoz0214.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Parser\n\n**JSON** is a **lightweight**, simple way of storing and transferring basic structured data, focusing on readability and simplicity. In fact, it is widely used to transmit data over a **network** and can be used for **configuration files**. Thus, JSON parsers/generators have been implemented in countless programming languages and other programs, so this project is no new feat (even more restricted in the fact it will only parse JSON, not generate it).\n\nNonetheless, C++ is a language that does not support JSON natively, but there indeed exist robust third party libraries to handle JSON. Still, this project is for educational purposes only, to gain a deeper understanding of how JSON works, and for some basic, introductory parsing practice.\n\nJSON is very dynamic whereas C++ is relatively rigid. Nonetheless, powerful usage of the **[std::variant](https://en.cppreference.com/w/cpp/utility/variant)** class allows for a safe, elegant way of representing JSON data in C++ without resorting to nasty alternatives such as void pointers. This is possible since JSON consists of a finite, manageable number of data types.\n\nFeatures of this mini C++ JSON parser:\n- Follows the **standard**: https://datatracker.ietf.org/doc/html/rfc8259\n- Parses JSON from a `std::string` object.\n- Parses JSON from a `std::istream` object (any valid standard C++ input stream, including file/string streams).\n- Correctly parses and stores JSON objects, arrays, numbers, strings and literals.\n- Provides a solid **error handling** scheme, including information on error positions where possible.\n- Can easily check two JSON objects for **equality**, a built-in feature of `std::variant`.\n- Decent performance with an elegant interface.\n\n## Usage\nThe code has proven to work on **Windows 10, g++ v12.1.0, C++17**. However, there is no known use of implementation-defined behaviour nor OS-specific behaviour. It is expected the code should compile on **any reasonable OS and conforming compiler, with C++17 minimum**.\n\nFrom the `src` folder, simply include the `json.h` header in your project and compile with the `json.cpp` file bundled, and you will be set. The parser does speed up with optimisations enabled during compilation.\n\nTo explore how to use the code, and how the code handles special JSON cases such as duplicate object keys, refer to [USAGE.md](USAGE.md)\n\n## Disclaimer\nWhilst performance is reasonable and the parser has been tested robustly, **bette JSON parsers exist** for C++. Use them if performance is important or robustness is vital, since this mini project may still contain hidden, rare bugs not caught by the non-exhaustive test cases.\n\nBut this parser can still be **quick and simple** to integrate into a project that handles **small JSON data**, particularly one that only needs to parse JSON and not generate it. For example, parsing a 1KB JSON file will probably take less than 100μs but this would depend on computer speed and type of data.\n\nThe code can be viewed and modified as you wish - there are no restrictions regarding the usage of the code. But there will be no liability due to any damages caused by the code.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoz0214%2Fjson-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleoz0214%2Fjson-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoz0214%2Fjson-parser/lists"}