How nlohmann/json works
nlohmann/json is a header-only C++ library for working with JSON values and converting between JSON and C++ types. The main workflow is to parse text or a supported binary format into a JSON value, inspect or edit it with container-style access, pointers, patches, or views, then serialize it or convert it to another type. The tree and README establish these capabilities; sampled implementation excerpts are limited, so internal call relationships are not asserted where they are not shown.
Main entry points: json.hpp JSON Value · json_view.hpp JSON View API · parser.hpp Text Parser · binary_reader.hpp Binary Reader
Components 18
Input Parsing
- Text Parser
include/nlohmann/detail/input/parser.hpp - Lexer
include/nlohmann/detail/input/lexer.hpp - Binary Reader
include/nlohmann/detail/input/binary_reader.hpp
JSON Values
- JSON API
include/nlohmann/json.hpp - JSON Value
include/nlohmann/json.hpp - Container Iterators
include/nlohmann/detail/iterators/iter_impl.hpp - Pointer and Patch
include/nlohmann/detail/json_pointer.hpp
Views and Editing
- JSON View API
include/nlohmann/json_view.hpp - View Builder
include/nlohmann/detail/view/builder.hpp - View Editor
include/nlohmann/detail/view/edit.hpp - View Serializer
include/nlohmann/detail/view/serializer.hpp - Edit Storage
include/nlohmann/detail/view/edit_storage.hpp
Conversion and Output
- Type Traits
include/nlohmann/detail/meta/type_traits.hpp - C++ Conversion
include/nlohmann/detail/conversions/from_json.hpp - JSON Conversion
include/nlohmann/detail/conversions/to_json.hpp - Text Serializer
include/nlohmann/detail/output/serializer.hpp - Binary Writer
include/nlohmann/detail/output/binary_writer.hpp
Other components
- C++ Application
Connections 19
- C++ Application → JSON API: uses
README.md - JSON API → Text Parser: parses text
- Text Parser → Lexer: tokenizes input
- JSON API → Binary Reader: reads binary
- Text Parser → JSON Value: produces values
- Binary Reader → JSON Value: produces values
- C++ Application → JSON Value: accesses values
README.md - JSON Value → Container Iterators: iterates with
- JSON Value → Pointer and Patch: supports pointers
README.md - JSON Value → JSON View API: creates views
- JSON View API → View Builder: builds views
- JSON View API → View Editor: edits document
- View Editor → Edit Storage: stores edits
- JSON View API → View Serializer: serializes view
- C++ Application → C++ Conversion: converts from JSON
README.md - C++ Application → JSON Conversion: converts to JSON
README.md - JSON Value → Text Serializer: serializes text
README.md - JSON Value → Binary Writer: writes binary
README.md - Type Traits → C++ Conversion: enables conversion