1
0
mirror of https://github.com/nlohmann/json synced 2024-12-02 00:20:06 +00:00
nlohmannjson/doc/examples/diagnostics_standard.cpp
2021-01-21 21:47:19 +01:00

21 lines
349 B
C++

#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
json j;
j["address"]["street"] = "Fake Street";
j["address"]["housenumber"] = "12";
try
{
int housenumber = j["address"]["housenumber"];
}
catch (json::exception& e)
{
std::cout << e.what() << '\n';
}
}