finds.dev← search

// the find

jart/json.cpp

★ 791 · C++ · NOASSERTION · updated Apr 2026

JSON for Classic C++

json.cpp is a C++ JSON parser extracted from llamafile, positioned explicitly as a reaction to nlohmann/json. It's aimed at C++ projects where compile times and runtime performance matter more than API ergonomics — think embedded servers, inference engines, anything that includes json.h in a hot compilation path.

The float32 serialization behavior is genuinely useful: it preserves the original type and serializes with appropriate precision instead of silently widening to double, which matters if you're serving embedding arrays over HTTP. The compile-time improvement is real and significant — 120ms vs 1200ms on a cold include is the kind of thing that compounds across a large codebase. JSONTestSuite conformance is better than nlohmann on the mandatory cases, which is a concrete correctness win, not a marketing claim. The codebase is small enough (1300 lines in the .cpp) that you can actually read and audit the parser yourself.

The external dependency on Google's double-conversion library is a meaningful adoption cost — you're pulling in a third-party library to use what's billed as a lightweight alternative to nlohmann. The API is old-school C++ with `std::map` under the hood, which means key iteration order is alphabetical, not insertion order, and there's no way to opt into ordered keys without changing the implementation. No streaming or SAX-style interface, so you're loading the entire document into memory before you can touch a single field — fine for API responses, a problem for large files. Documentation is thin: the README is essentially one usage example from llamafile, and there's no API reference or migration guide from nlohmann.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →