75. Serializing data to JSON
As with XML, no standard support for JSON exists. However, there are a large number of cross-platform libraries for this purpose. At the time of writing, the nativejson-benchmark project, available at https://github.com/miloyip/nativejson-benchmark, lists more than 40 libraries. This project is a benchmark that evaluates the conformance and performance (speed, memory, and code size) of open source C/C++ libraries with JSON parsing/generation capabilities. This makes it perhaps a bit hard to choose the right library, although top contenders may include RapidJSON, NLohmann, taocpp/json, Configuru, json_spirit, jsoncpp. For solving this task we will use here the nlohmann/json library. It is a cross-platform, header ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access