2017-07-09 09:51:38 +00:00
|
|
|
#include <iostream>
|
2018-02-01 21:20:26 +00:00
|
|
|
#include <nlohmann/json.hpp>
|
2015-07-08 14:55:29 +00:00
|
|
|
|
2016-01-30 19:23:14 +00:00
|
|
|
using json = nlohmann::json;
|
2015-07-08 14:55:29 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// create a JSON value
|
|
|
|
json value = { "the good", "the bad", "the ugly" };
|
|
|
|
|
|
|
|
// create string_t
|
|
|
|
json::string_t string = "the fast";
|
|
|
|
|
|
|
|
// swap the object stored in the JSON value
|
|
|
|
value[1].swap(string);
|
|
|
|
|
|
|
|
// output the values
|
|
|
|
std::cout << "value = " << value << '\n';
|
|
|
|
std::cout << "string = " << string << '\n';
|
|
|
|
}
|