explaingit

nlohmann/json

📈 Trending49,732C++Audience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

A C++ library that makes reading, writing, and working with JSON data feel natural, with a single-header design requiring no external dependencies.

Mindmap

mindmap
  root((repo))
    What it does
      Parse JSON strings
      Create JSON structures
      Access nested values
      Convert to C++ types
    Key features
      Single header file
      No external deps
      JSON Pointer support
      Binary formats
    Use cases
      Config file parsing
      Web API calls
      Data exchange
      Service integration
    Tech stack
      C++11 or later
      Header-only
      Standard library
    Audience
      C++ developers
      Systems engineers
      Backend builders

Things people build with this

USE CASE 1

Parse JSON configuration files in C++ applications without external dependencies.

USE CASE 2

Call REST APIs and deserialize JSON responses into C++ objects.

USE CASE 3

Serialize C++ data structures to JSON for inter-process communication or storage.

USE CASE 4

Convert between JSON and standard C++ containers like vectors and maps.

Tech stack

C++11C++14C++17C++20

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

nlohmann/json is a C++ library that makes working with JSON data feel natural and straightforward. JSON, which stands for JavaScript Object Notation, is a widely used format for storing and exchanging data between programs and APIs, but C++ does not have built-in JSON support the way languages like Python or JavaScript do. This library bridges that gap by providing a json type that you can use in C++ code almost like a native data structure. The library's key design goal is making integration trivially easy. The entire implementation lives in a single header file, json.hpp, which means you just copy or include one file in your project with no separate compilation step, no linking against an external library, and no changes to your build configuration. Once included, you can parse JSON from a string or file, access nested values using bracket notation, create JSON structures by assigning C++ values, and convert between JSON and standard C++ containers like std::vector and std::map. It also supports advanced features like JSON Pointer for addressing nested elements, JSON Patch for describing changes to a JSON document, and several binary serialization formats like CBOR and MessagePack as alternatives to plain text JSON. You would use this library when you are writing a C++ program that needs to read a configuration file, call a web API, parse data from a service, or exchange structured data with another system that uses JSON. It is aimed at developers who want clean, readable code over maximum raw parsing speed. The library requires a C++11-capable compiler and is widely available through package managers like Conan, vcpkg, and most Linux distribution repositories. The tech stack is pure modern C++.

Copy-paste prompts

Prompt 1
Show me how to parse a JSON string and access nested values using nlohmann/json in C++.
Prompt 2
How do I use nlohmann/json to read a configuration file and convert it to C++ objects?
Prompt 3
Write a C++ example that calls a REST API, parses the JSON response, and extracts specific fields using nlohmann/json.
Prompt 4
How do I serialize a C++ struct to JSON using nlohmann/json and send it over HTTP?
Prompt 5
Show me how to use JSON Pointer with nlohmann/json to access deeply nested elements.
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.