-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathprint_json.cpp
34 lines (27 loc) · 859 Bytes
/
print_json.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*!
\file print_json.cpp
\brief Fast Binary Encoding print JSON example
\author Ivan Shynkarenka
\date 16.08.2018
\copyright MIT License
*/
#include "../proto/test_json.h"
#include <iostream>
int main(int argc, char** argv)
{
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
buffer.Clear();
writer.Reset(buffer);
FBE::JSON::to_json(writer, test::StructSimple());
std::cout << buffer.GetString() << std::endl << std::endl;
buffer.Clear();
writer.Reset(buffer);
FBE::JSON::to_json(writer, test::StructOptional());
std::cout << buffer.GetString() << std::endl << std::endl;
buffer.Clear();
writer.Reset(buffer);
FBE::JSON::to_json(writer, test::StructNested());
std::cout << buffer.GetString() << std::endl << std::endl;
return 0;
}