What C++ standard is targeted?
C++17 — the generated code uses std::string, std::vector, and std::any, all of which are part of the C++17 standard library. std::any is used for nullable JSON values; if you target C++14 replace it with void* or boost::any. The structs themselves are POD-compatible (Plain Old Data) so they can be aggregate-initialized.
Should I use std::variant for mixed-type fields?
Yes when a JSON field can legitimately hold multiple types — std::variant<std::string, int, std::nullptr_t> models a "string or integer or null" field exactly. The generator does not infer variants from a single sample (it picks the type of the first observed value), so add std::variant manually after generation when you know a field is polymorphic.
What about nlohmann/json for parsing?
nlohmann/json (single-header, MIT-licensed) is the most popular C++ JSON library and supports automatic struct serialization with NLOHMANN_DEFINE_TYPE_INTRUSIVE(StructName, field1, field2). Add that macro inside each generated struct and then nlohmann::json::parse(text).get<Root>() works out of the box. Other options: rapidjson (faster, lower-level) and simdjson (fastest parsing, read-only).
How are nested JSON objects handled?
Each nested JSON object becomes its own top-level C++ struct. The parent struct holds it by value (not pointer) since C++ aggregates compose naturally — no manual memory management. Forward declarations are not needed because nested structs are emitted before their referencing parent.
How are JSON arrays mapped?
A JSON array becomes std::vector<T> where T is inferred from the first element. Arrays of objects become std::vector<ChildStruct>; arrays of strings become std::vector<std::string>. For arrays of mixed types use std::vector<std::any> after generation.
Why structs and not classes?
In C++, struct and class are nearly identical — the only difference is default member visibility (public for struct, private for class). DTOs typically expose all fields publicly, which makes struct the idiomatic choice and removes the need to write public: explicitly. Convert to class with private + public methods if you need encapsulation.
Is the JSON uploaded to your servers?
No. Conversion runs entirely in your browser via JavaScript. Open DevTools → Network and click Convert — no requests are made. Pasting JSON containing tokens or proprietary data never leaves your machine.
How do I serialize back to JSON?
With nlohmann/json: add NLOHMANN_DEFINE_TYPE_INTRUSIVE(Root, id, name, active) inside each struct, then nlohmann::json j = root; produces the JSON. The library uses argument-dependent lookup to find the macro-generated to_json/from_json functions automatically.