nlohmann-json

JSON library for modern C++ with intuitive syntax

brewmacoslinux
Try with needOr install directly
Source

About

JSON for modern C++

Commands

nlohmann-json

Examples

Include the header in C++ code to parse JSON strings$ #include <nlohmann/json.hpp> using json = nlohmann::json; json j = json::parse("[1, 2, 3]");
Create and serialize JSON objects in C++$ json j; j["name"] = "John"; j["age"] = 30; std::cout << j.dump();
Access nested JSON elements$ json j = json::parse("{\"user\": {\"id\": 1}}"); int id = j["user"]["id"];