OSS TanbouSign in with GitHub

build, parse, transform, and serialize JSON as C++ values

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
50,720
Primary language
C++
License
MIT
Repository last updated
Oct 4, 2026
On this page

Overview

JSON for Modern C++ is a single-header library that treats JSON much like native C++ objects and arrays. Its STL-like API covers parsing strings and streams, updating values, formatted output, and conversion to binary formats.

Features and best fit

Hands-on tested within the scope below · Content checked:

Key features

Work with JSON through container-like C++ operations

Objects and arrays can be assembled with initializer lists and accessed with operator[], at, find, and related APIs. parse reads strings or streams, while dump and stream output serialize values, so configuration files and API payloads can share one value model.

Sources: [1]

Use a single header with standard and binary formats

Including json.hpp provides JSON Pointer, JSON Patch, Merge Patch, and conversion to formats such as CBOR, MessagePack, BSON, and UBJSON. The project also documents CMake integration through the nlohmann_json::nlohmann_json target.

Sources: [1][2]

Best fit

Add JSON handling to an existing C++ application

It fits teams that want configuration, messages, and test fixtures inside C++ without another process or large runtime. Developers familiar with STL containers can use familiar conversion and iteration patterns.

Sources: [1]

Before adoption

Account for performance goals and malformed input

The README explicitly prioritizes developer convenience rather than minimum memory use or maximum speed. Applications accepting untrusted data still need exception handling, input-size limits, and an explicit policy for non-UTF-8 strings during serialization.

Sources: [1]

3.12.0 / C++ compiler with C++11 support

Pinned release header compiled; parsing, mutation, serialization, reparsing, and assertions executed locally.

Official sources

  1. [1]JSON for Modern C++ 3.12.0 README(2026-10-04)
  2. [2]JSON for Modern C++ 3.12.0 release(2026-10-04)
  3. [3]JSON for Modern C++ 3.12.0 MIT license(2026-10-04)
Supplemental curator note

Its readable API and low-friction integration cover tasks from configuration loading to API response generation. For workloads dominated by speed or memory constraints, benchmark it against alternative JSON implementations with representative data.

Try it in 3 steps

  1. 1

    Download the 3.12.0 single header

    With curl and a C++11 compiler available, save json.hpp from the published release in a working directory.

    mkdir -p json-3.12.0-demo && cd json-3.12.0-demo && curl -fL -o json.hpp https://github.com/nlohmann/json/releases/download/v3.12.0/json.hpp
  2. 2

    Write a parsing and serialization example

    Generate a small C++ program that parses JSON, adds a value, serializes it, and parses it again.

    printf '%s\n' '#include "json.hpp"' '#include <cassert>' '#include <iostream>' 'int main() {' ' auto value = nlohmann::json::parse(R"({"project":"OSS Tanbou","stars":3})");' ' value["ready"] = true;' ' const auto encoded = value.dump();' ' const auto decoded = nlohmann::json::parse(encoded);' ' assert(decoded["project"] == "OSS Tanbou" && decoded["ready"] == true);' ' std::cout << encoded << "\n";' '}' > demo.cpp
  3. 3

    Compile and verify the round trip

    Build in C++11 mode, check the decoded values with assertions, and print the serialized result.

    c++ -std=c++11 -I. demo.cpp -o demo && ./demo
Check the official README

Growth

Growth trends · Last 30 days

50,720 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
178
Open PRs
52

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • json
  • json-pointer
  • json-patch
  • cbor
  • msgpack
  • header-only
  • stl-containers
  • json-serialization
  • json-parser
  • rfc-6901
  • rfc-6902
  • rfc-7159
Stars
50,720
Forks
7,510
Watchers
740
Open issues
30
Contributors
386
Owner type
User
Primary language
C++
License
MIT
Repository last updated
Oct 4, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?