What JSON library do you suggest?

This page summarizes the projects mentioned and recommended in the original post on /r/cpp

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • RapidJSON

    A fast JSON parser/generator for C++ with both SAX/DOM style API

  • Thank you for your response. In reply to the first issue you raise, note that Tencent gives the following guidance: "Generally speaking, RapidJSON should be exception-safe (enough) to replace RAPIDJSON_ASSERT by an exception." If some of those functions are now noexcept, that would be... unfortunate. Especially if this is the kind of noexcept that gets randomly slapped on functions nowadays "because we can", rather than "because we must".

  • json

    JSON for Modern C++

  • https://github.com/nlohmann/json for ease of use; I'd suggest this as your general go to, and switch libraries if extreme performance is needed, and reading large amounts of JSON is part of the bottleneck. In which case https://github.com/simdjson/simdjson

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • simdjson

    Parsing gigabytes of JSON per second : used by Facebook/Meta Velox, the Node.js runtime, ClickHouse, WatermelonDB, Apache Doris, Milvus, StarRocks

  • https://github.com/nlohmann/json for ease of use; I'd suggest this as your general go to, and switch libraries if extreme performance is needed, and reading large amounts of JSON is part of the bottleneck. In which case https://github.com/simdjson/simdjson

    I am biased, so will suggest DAW JSON Link https://github.com/beached/daw_json_link. Fast and allows for a declarative mapping of JSON to your data structures. This allows it to optimize based on what you will be parsing and get past the intermediary DOM types. A nice benefit there is that the limits on the parser are the limits of your type(you can parse to a bigint or a rational type if needed)

  • JsonCpp

    A C++ library for interacting with JSON.

  • I like https://github.com/open-source-parsers/jsoncpp

  • json_struct

    json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa

  • json_struct for serializing directly to and from structs. Its one header only and performs on par with RapidJSON.

  • univalue

    An easy-to-use and competitively fast JSON parsing library for C++17, forked from Bitcoin Cash Node's own UniValue library.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • json_dto

    A small header-only library for converting data between json representation and c++ structs

  • json_dto on top of RapidJSON.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts