00001 #include <json.hpp> 00002 00003 using json = nlohmann::json; 00004 00005 int main() 00006 { 00007 // create stream with serialized JSON 00008 std::stringstream ss; 00009 ss << R"({ 00010 "number": 23, 00011 "string": "Hello, world!", 00012 "array": [1, 2, 3, 4, 5], 00013 "boolean": false, 00014 "null": null 00015 })"; 00016 00017 // create JSON value and read the serialization from the stream 00018 json j; 00019 j << ss; 00020 00021 // serialize JSON 00022 std::cout << std::setw(2) << j << '\n'; 00023 }