2015-06-24 10:15:51 +00:00
|
|
|
#include <json.hpp>
|
|
|
|
|
2016-01-30 19:23:14 +00:00
|
|
|
using json = nlohmann::json;
|
2015-06-24 10:15:51 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// create two JSON values
|
|
|
|
json j1 = {1, 2, 3, 4, 5};
|
|
|
|
json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}};
|
|
|
|
|
|
|
|
// swap the values
|
|
|
|
j1.swap(j2);
|
|
|
|
|
|
|
|
// output the values
|
|
|
|
std::cout << "j1 = " << j1 << '\n';
|
|
|
|
std::cout << "j2 = " << j2 << '\n';
|
|
|
|
}
|