2017-04-21 22:07:07 +02:00
|
|
|
#include "json.hpp"
|
2015-07-08 16:55:29 +02:00
|
|
|
|
2016-01-30 20:23:14 +01:00
|
|
|
using json = nlohmann::json;
|
2015-07-08 16:55:29 +02:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// create JSON values
|
|
|
|
json object = {{"one", 1}, {"two", 2}};
|
|
|
|
json null;
|
|
|
|
|
|
|
|
// print values
|
|
|
|
std::cout << object << '\n';
|
|
|
|
std::cout << null << '\n';
|
|
|
|
|
|
|
|
// add values
|
|
|
|
object.push_back(json::object_t::value_type("three", 3));
|
|
|
|
object += json::object_t::value_type("four", 4);
|
|
|
|
null += json::object_t::value_type("A", "a");
|
|
|
|
null += json::object_t::value_type("B", "b");
|
|
|
|
|
|
|
|
// print values
|
|
|
|
std::cout << object << '\n';
|
|
|
|
std::cout << null << '\n';
|
|
|
|
}
|