more documentation
This commit is contained in:
parent
770b9820fe
commit
c85dbef98f
9 changed files with 441 additions and 85 deletions
18
doc/examples/operator_serialize.cpp
Normal file
18
doc/examples/operator_serialize.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create JSON values
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
json j_array = {1, 2, 4, 8, 16};
|
||||
|
||||
// serialize without indentation
|
||||
std::cout << j_object << "\n\n";
|
||||
std::cout << j_array << "\n\n";
|
||||
|
||||
// serialize with indentation
|
||||
std::cout << std::setw(4) << j_object << "\n\n";
|
||||
std::cout << std::setw(2) << j_array << "\n\n";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue