Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Library:JSON for Modern C++

From ReverseEngineering.wiki
Library
License MIT
Website https://github.com/nlohmann/json
On this wiki Facts · Code · Notes · Topics

nlohmann/json is a header-only MIT C++ JSON library; binaries that use it carry exception texts of the form [json.exception.parse_error.101] and the NLOHMANN_JSON_VERSION macros.

Overview

Header-only, so everything is compiled into the host binary; no DLL to look for. Identify it from strings.

Identification

  • Every exception message begins with [json.exception.<name>.<id>] (exceptions.hpp builds it as concat("[json.exception.", name, '.', id, "] ")). Names: parse_error, invalid_iterator, type_error, out_of_range, other_error. Ids are in Fact:JSON for Modern C++/enum/Exception ids.
  • Parse errors read like [json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal. The pieces syntax error while parsing, unexpected , ; expected , ; last read: ' and the token names ('[', end of input, true literal, <parse error>) come from parser.hpp and lexer.hpp.
  • Lexer messages such as invalid string: control character U+0000 (NUL) must be escaped to \u0000, invalid string: missing closing quote, invalid string: ill-formed UTF-8 byte.
  • Version: macros NLOHMANN_JSON_VERSION_MAJOR/MINOR/PATCH (3.12.0 at the checked commit); they are compile-time only, so in a binary the version is guessed from which messages exist. The ABI inline namespace is json_abi plus tags (for example _diag, _ldvcmp), visible in mangled names as nlohmann::json_abi_v3_12_0::basic_json. At the checked commit include/nlohmann/detail/abi_macros.hpp (lines 110-141) builds the inline namespace as json_abi + the ABI tags that are enabled + _v<major>_<minor>_<patch>, in the tag order diagnostics (_diag), legacy discarded-value comparison (_ldvcmp), diagnostic positions (_dp), brace-init copy semantics (_bics), precise stream position (_psp), strict NUL handling (_snul), strict binary UTF-8 (_sbu8), enum-keyed maps as objects (_ekmo); with no tag it is json_abi_v3_12_0, with the first two json_abi_diag_ldvcmp_v3_12_0. The spelling in older releases was not read.
  • With JSON_DIAGNOSTICS the message carries a path prefix such as (/a/b) .

Why it matters

The error strings often sit next to config or network JSON parsing: xrefs to them lead to the code that loads settings or server replies.

Code & repositories

  • https://github.com/nlohmann/json (MIT)
  • https://github.com/nlohmann/json @ 0e95fe8200adbf0e033d0c0818eea473e1d4d346 · license: MIT
    Exception ids and messages, parser and lexer error texts.
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries