2015-07-08 17:55:29 +03:00
|
|
|
#include <json.hpp>
|
|
|
|
|
2016-01-30 22:23:14 +03:00
|
|
|
using json = nlohmann::json;
|
2015-07-08 17:55:29 +03:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// create a JSON value
|
|
|
|
json value = { {"translation", {{"one", "eins"}, {"two", "zwei"}}} };
|
|
|
|
|
|
|
|
// create an object_t
|
|
|
|
json::object_t object = {{"cow", "Kuh"}, {"dog", "Hund"}};
|
|
|
|
|
|
|
|
// swap the object stored in the JSON value
|
|
|
|
value["translation"].swap(object);
|
|
|
|
|
|
|
|
// output the values
|
|
|
|
std::cout << "value = " << value << '\n';
|
|
|
|
std::cout << "object = " << object << '\n';
|
|
|
|
}
|