mirror of
https://github.com/nlohmann/json.git
synced 2024-08-22 13:02:28 +02:00
21 lines
418 B
C++
21 lines
418 B
C++
#include <iostream>
|
|
#include "json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
int main()
|
|
{
|
|
try
|
|
{
|
|
// calling push_back() on a string value
|
|
json j = "string";
|
|
j.push_back("another string");
|
|
}
|
|
catch (json::type_error& e)
|
|
{
|
|
// output exception information
|
|
std::cout << "message: " << e.what() << '\n'
|
|
<< "exception id: " << e.id << std::endl;
|
|
}
|
|
}
|