1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-22 15:21:52 +03:00

📝 more documentation for the new exceptions

This commit is contained in:
Niels Lohmann
2017-03-08 23:30:38 +01:00
parent 1ab580d6e9
commit 0f6b8aa718
11 changed files with 89 additions and 23 deletions

View File

@ -32,4 +32,14 @@ int main()
j.at("/array/1"_json_pointer) = 21;
// output the changed array
std::cout << j["array"] << '\n';
// try to use an invalid JSON pointer
try
{
auto ref = j.at("/number/foo"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
}