Fast, direct and static typed parsing of JSON with C++.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
#include <staticjson/staticjson.hpp>
Parse JSON into a struct
#include <staticjson/staticjson.hpp>
#include <iostream>
struct Point { double x, y; };
namespace staticjson {
template <> struct TypeHandler<Point> {
static bool from_json(const Document &d, Point &p) {
p.x = d["x"].GetDouble();
p.y = d["y"].GetDouble();
return true;
}
};
}
int main() {
staticjson::Document doc;
doc.Parse("{\"x\":1.0,\"y\":2.0}");
Point p;
staticjson::from_json(doc, p);
std::cout << p.x << ", " << p.y << std::endl;
return 0;
}
Debug
Known footguns
No known footguns recorded.
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Resources
No resource links recorded.