/
githubmirror
/
json
Обзор
Документация
Войти
/
githubmirror
/
json
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v3.11.3
docs/examples/exception.cpp
20 строк
438 B
Ivor Wanders
Capture exceptions by const& in docs. (#4099)
23 сен 2023, 18:19
Не верифицирован
23 сен 2023, 18:19
aa87ab8
Код
Авторство
О чём код?
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { try { // calling at() for a non-existing key json j = {{"foo", "bar"}}; json k = j.at("non-existing"); } catch (const json::exception& e) { // output exception information std::cout << "message: " << e.what() << '\n' << "exception id: " << e.id << std::endl; } }