mirror of
https://github.com/nlohmann/json.git
synced 2025-07-06 06:42:33 +03:00
📝 update documentation
This commit is contained in:
20
doc/examples/diagnostics_standard.cpp
Normal file
20
doc/examples/diagnostics_standard.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#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';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user