adl_serializer and template types
Free-function tojson/fromjson only works when you can add a function to the type's own
Free-function tojson/fromjson only works when you can add a function to the type's own
CBOR, MessagePack, BSON, UBJSON, and BJData all describe the same data model JSON does — the same
Every C++ JSON library parses the same grammar into more or less the same tree shape. Where they
Construction is where the library's convenience is loudest — you can build a document out of
json isn't a concrete class — it's using json = basic_json;, one particular instantiation of
The project's own README states its goals plainly: intuitive syntax, trivial integration, and
There are four ways to read a key or index out of a json, and they disagree on what happens when
Every failure in this library — a malformed parse, a wrong-type access, a missing key, an invalid
There isn't one right way to add nlohmann/json to a project — there's a spectrum from "copy one
Iterating a json container gives you values, never key-value pairs — a design choice inherited
RFC 6901 (JSON Pointer) and RFC 6902 (JSON Patch) give you standardized addressing and diffing for
"Combine two documents" turns out to mean three different, non-interchangeable operations in this
JSON has exactly one number type — an arbitrary-precision decimal, syntactically. C++ has several,
nlohmann/json — formally "JSON for Modern C++" — is a
Parsing is the boundary between untrusted text and typed data. Every way into a json value from
The library's defaults are tuned for ergonomics, not throughput, and most of the performance
dump() is the inverse of parse() — it turns a json value back into text — and its defaults
Writing tojson/fromjson by hand for a plain data struct is mostly boilerplate — list the
json is one C++ type that behaves like several types at runtime — a tagged union with container
DOM parsing — json::parse — builds the entire document in memory before you can look at any of
The library never sees your type definitions — it doesn't know what a Person or an Order is.
This is where the library's "intuitive syntax" goal collides most directly with C++ overload
Before this library, JSON in C++ meant one of two things: a hand-rolled recursive-descent parser