mirror of
https://github.com/nlohmann/json.git
synced 2026-05-30 10:05:24 +00:00
📝 update documentation
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#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';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<a target="_blank" href="https://wandbox.org/permlink/pbz3ULoJ4maRnV8N"><b>online</b></a>
|
||||
@@ -0,0 +1 @@
|
||||
[json.exception.type_error.302] (/address/housenumber) type must be number, but is string
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<a target="_blank" href="https://wandbox.org/permlink/fWfQhHzG03P6PAcC"><b>online</b></a>
|
||||
@@ -0,0 +1 @@
|
||||
[json.exception.type_error.302] type must be number, but is string
|
||||
Reference in New Issue
Block a user