Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lefticus/json2cpp
Compiles JSON into static constexpr C++ data structures with nlohmann::json API
https://github.com/lefticus/json2cpp
cpp cpp17 json json-schema
Last synced: about 5 hours ago
JSON representation
Compiles JSON into static constexpr C++ data structures with nlohmann::json API
- Host: GitHub
- URL: https://github.com/lefticus/json2cpp
- Owner: lefticus
- License: mit
- Created: 2022-01-31T15:29:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-06T06:15:32.000Z (6 months ago)
- Last Synced: 2024-06-12T03:02:29.094Z (5 months ago)
- Topics: cpp, cpp17, json, json-schema
- Language: CMake
- Homepage:
- Size: 1.06 MB
- Stars: 248
- Watchers: 12
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# json2cpp
![CI](https://github.com/lefticus/json2cpp/workflows/ci/badge.svg)
[![codecov](https://codecov.io/gh/lefticus/json2cpp/branch/main/graph/badge.svg)](https://codecov.io/gh/lefticus/json2cpp)
[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/lefticus/json2cpp)](https://lgtm.com/projects/g/lefticus/json2cpp/context:cpp)**json2cpp** compiles a json file into `static constexpr` data structures that can be used at compile time or runtime.
Features
* Literally 0 runtime overhead for loading the statically compiled JSON resource
* Fully constexpr capable if you want to make compile-time decisions based on the JSON resource file
* A `.cpp` firewall file is provided for you, if you have a large resource and don't want to pay the cost of compiling it more than once (but for normal size files it is VERY fast to compile, they are just data structures)
* [nlohmann::json](https://github.com/nlohmann/json) compatible API (should be a drop-in replacement, some features might still be missing)
* [valijson](https://github.com/tristanpenman/valijson) adapter file providedSee the [test](test) folder for examples for building resources, using the valijson adapter, constexpr usage of resources, and firewalled usage of resources.