mirror of
https://github.com/nlohmann/json.git
synced 2024-12-01 11:39:03 +08:00
9b32f72584
As I learned in https://github.com/melpon/wandbox/issues/209, this library is already installed at Wandbox, so we need to adjust the examples to use `#include "json.hpp"` insteas of `#include <json.hpp>`.
18 lines
343 B
C++
18 lines
343 B
C++
#include "json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
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';
|
|
}
|