https://github.com/yhirose/cpp-jsonlib
A C++17 single-file header-only library to wrap RapidJSON SAX interface
https://github.com/yhirose/cpp-jsonlib
cpp17 json sax-parser
Last synced: 6 months ago
JSON representation
A C++17 single-file header-only library to wrap RapidJSON SAX interface
- Host: GitHub
- URL: https://github.com/yhirose/cpp-jsonlib
- Owner: yhirose
- License: mit
- Created: 2021-10-16T22:00:27.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-17T01:43:51.000Z (almost 4 years ago)
- Last Synced: 2025-04-24T00:49:33.813Z (6 months ago)
- Topics: cpp17, json, sax-parser
- Language: C++
- Homepage:
- Size: 3.91 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cpp-jsonlib
A C++17 single-file header-only library for [RapidJSON SAX interface](https://rapidjson.org/md_doc_sax.html)
```cpp
#include
#include "jsonlib.h"int main(void) {
std::string json;
while (std::getline(std::cin, json)) {
std::string key;
jsonlib::parse(json, {
.Key = [&](auto str, auto len) {
key.assign(str, len);
},
.String = [&](auto str, auto len) {
std::cout << key << ": " << std::string(str, len) << std::endl;
}
});
}
}
```