Skip to main content

23 docs tagged with "nlohmann-json"

View all tags

Binary formats

CBOR, MessagePack, BSON, UBJSON, and BJData all describe the same data model JSON does — the same

Creating JSON values

Construction is where the library's convenience is loudest — you can build a document out of

Design philosophy

The project's own README states its goals plainly: intuitive syntax, trivial integration, and

Element access

There are four ways to read a key or index out of a json, and they disagree on what happens when

Iterating JSON

Iterating a json container gives you values, never key-value pairs — a design choice inherited

Merging and comparison

"Combine two documents" turns out to mean three different, non-interchangeable operations in this

Parsing JSON

Parsing is the boundary between untrusted text and typed data. Every way into a json value from

Serialization macros

Writing tojson/fromjson by hand for a plain data struct is mostly boilerplate — list the

The JSON value type

json is one C++ type that behaves like several types at runtime — a tagged union with container

The SAX interface

DOM parsing — json::parse — builds the entire document in memory before you can look at any of

to_json and from_json

The library never sees your type definitions — it doesn't know what a Person or an Order is.

What is nlohmann/json?

Before this library, JSON in C++ meant one of two things: a hand-rolled recursive-descent parser