https://github.com/twct/brace
Incredibly simple JSON parser in C++
https://github.com/twct/brace
cpp json
Last synced: 2 months ago
JSON representation
Incredibly simple JSON parser in C++
- Host: GitHub
- URL: https://github.com/twct/brace
- Owner: twct
- License: mit
- Created: 2024-12-12T00:55:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-04T20:29:21.000Z (over 1 year ago)
- Last Synced: 2025-03-31T14:18:27.274Z (over 1 year ago)
- Topics: cpp, json
- Language: C++
- Homepage: https://brace.thrift.dev
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# brace
Incredibly simple JSON parser in C++
## Example usage
```cpp
auto json_str = R"({"hello": "world"})";
brace::Parser parser;
auto json = parser.parse(json_str).expect("parse");
std::string hello = json["hello"];
printf("Hello, %s!\n", hello.c_str());
```
## Getting Started
A C++ compiler with at least support for C++17 is required. The easiest way to get started is by adding [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake/blob/v0.40.2/cmake/CPM.cmake) to your project:
```cmake
include(cmake/CPM.cmake)
CPMAddPackage("gh:twct/brace#git_tag_or_rev_sha")
target_link_libraries(MyTarget PRIVATE brace)
```
**Build & run unit tests**
```sh
$ mkdir build && cd build
$ cmake -G Ninja -DBRACE_BUILD_TESTS=on ..
$ ninja && ninja test
```
**Build docs**
```sh
$ cd docs && make
# bundle as zip
$ make zip
```
## Compatibility
brace has been tested the following compilers:
- Clang 15.0.0 (macOS)
- MSVC 19.41.34120 (Windows)
- GCC 14.2.1 (Linux)