finds.dev

lefticus/json2cpp

Compiles JSON into static constexpr C++ data structures with nlohmann::json API

View on GitHub

★ 293CMakeMITupdated May 2024

// the take

A build-time code generator that turns a JSON file into static constexpr C++ data structures, exposing an API that mimics nlohmann::json. It's for people who have config or schema data fixed at compile time (embedded firmware, game data, generated tables) and want to skip runtime JSON parsing entirely.

Zero runtime parsing cost is real, not marketing — the data is baked into the binary as constexpr structures, so there's no heap allocation or string parsing on startup. The nlohmann::json-compatible API means existing code using that library can often switch over with minimal changes. The firewall file pattern (compile the generated data once into a .cpp, link against it) is a sensible solution to the real problem of large generated headers blowing up compile times. The valijson adapter is a nice touch if you also want compile-time schema validation.

Last commit is from May 2024 — over two years with no activity, so treat this as unmaintained rather than actively supported. The README itself admits 'some features might still be missing' from full nlohmann::json parity, so the drop-in replacement claim needs verification against your actual usage before you commit to it. It only solves one narrow problem: JSON that's fully known at build time. Anything loaded at runtime (user uploads, network responses, config that changes without a rebuild) is out of scope entirely, so don't mistake this for a general JSON library. With 293 stars and 25 forks, it hasn't seen much real-world battle-testing outside whatever lefticus's own projects use it for.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

search the same ground:

// at a glance

Stars
293
Forks
25
Language
CMake
License
MIT
Last commit
6 May 2024

// nearby

If json2cpp isn't quite it.

All repos →