1#include <iostream> 2 3# define JSON_DIAGNOSTICS 1 4#include <nlohmann/json.hpp> 5 6using json = nlohmann::json; 7 8int main() 9{ 10 json j; 11 j["address"]["street"] = "Fake Street"; 12 j["address"]["housenumber"] = "12"; 13 14 try 15 { 16 int housenumber = j["address"]["housenumber"]; 17 } 18 catch (json::exception& e) 19 { 20 std::cout << e.what() << '\n'; 21 } 22} 23