Logo
Explore Help
Register Sign In
lenn/json
1
0
Fork 0
You've already forked json
mirror of https://github.com/nlohmann/json.git synced 2025-11-24 03:44:06 +08:00
Code Issues Packages Projects Releases Wiki Activity
Files
ce7d0ebf5d0ef7b098a60d10399a0de866f012bd
json/doc/examples/swap__reference.cpp

19 lines
363 B
C++
Raw Normal View History

:memo: cleanup after #650 As <iostream> is not included in json.hpp any more, all code examples need to include <iostream> now.
2017-07-09 11:51:38 +02:00
#include <iostream>
:memo: fixed examples for Wandbox 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>`.
2017-04-21 22:07:07 +02:00
#include "json.hpp"
more documentation In this commit, also the semantics for values skipped via the parser callback has changed. Now, the top-level value is returned as “null” instead of “discarded”.
2015-06-24 12:15:51 +02:00
removed "using namespace" from examples
2016-01-30 20:23:14 +01:00
using json = nlohmann::json;
more documentation In this commit, also the semantics for values skipped via the parser callback has changed. Now, the top-level value is returned as “null” instead of “discarded”.
2015-06-24 12:15:51 +02: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';
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.3 Page: 2605ms Template: 100ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API