← All open source projects

nlohmann/json

nlohmann/json

nlohmann/json is a header-only JSON library for C++ with convenient syntax and a “JSON as a data type” feel.

Forks 7,410
Author nlohmann
Language C++
License Unknown
Synced 2026-06-27

What it is

nlohmann/json is a popular JSON library for C++ distributed as header-only and designed to make JSON feel like an ordinary data type.

The project appeared from the desire to work with JSON in C++ without heavy scaffolding and without a too-low-level API.

The library’s main task is to provide convenient creation, reading, serialization, and transformation of JSON structures in C++ code.

What is inside the repository

The repository highlights design goals, support, quick reference, examples, documentation, FAQ, discussions, API, and issues.

Examples include reading JSON from a file, creating objects from JSON literals, and treating JSON as a first-class data type.

How people usually use it

The library is used in C++ services, desktop apps, tools, configuration files, and data exchange between systems.

A normal scenario is to include the header, create a json object, read fields, serialize a result, or parse an input string.

JSON as an ordinary C++ object

This example shows the library’s main idea: JSON can be created and read with understandable C++ syntax.

Language: Plain text
json user = {
  {"name", "Ada"},
  {"admin", true}
};

std::string name = user["name"];

What it feels like in practice

The project’s strength is convenience. In C++, this is especially visible: JSON work becomes closer to modern high-level code.

Another advantage is simple header-only integration, which is convenient for small projects and libraries.

Limits and careful spots

The limitation is that convenience can have resource costs. Strict memory and speed requirements should be measured separately.

Input validation and parse errors also matter, especially when JSON comes from outside.

Who it fits

nlohmann/json best fits C++ projects that need an understandable and quick-to-integrate JSON layer.

In the catalog, nlohmann/json matters as a library that made a common C++ task much more pleasant.

In long-term work with a project like this, installation is not the only concern: the team needs a clear boundary of responsibility, an update routine, and an owner for usage rules.

In practice, this means running a minimal example before adoption, checking configuration, reviewing updates, and understanding which data or processes are touched. That short pass quickly shows where the project helps immediately and where the team still needs its own decisions.

If the project becomes part of a public site, product, or internal platform, it should be recorded in team documentation: source link, version, owner, and update rhythm. Then the open code remains a managed dependency rather than a random fragment of infrastructure.