forked from Research/WhisperCom
Dominik Meyer
cc002ebfbb
git-subtree-dir: libs/json git-subtree-split: f42a74b8f53cc308647123d49d33d1c8122e3f42
23 lines
378 B
C++
23 lines
378 B
C++
#include <iostream>
|
|
|
|
# define JSON_DIAGNOSTICS 1
|
|
#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';
|
|
}
|
|
}
|