MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / main

Function main

examples/src/ojson_examples.cpp:10–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8using namespace jsoncons;
9
10int main()
11{
12 std::cout << "\nojson examples\n\n";
13
14 ojson o = ojson::parse(R"(
15 {
16 "street_number" : "100",
17 "street_name" : "Queen St W",
18 "city" : "Toronto",
19 "country" : "Canada"
20 }
21 )");
22
23 std::cout << pretty_print(o) << '\n';
24
25 o.insert_or_assign("postal_code", "M5H 2N2");
26 std::cout << pretty_print(o) << '\n';
27
28 ojson o2 = o;
29
30 ojson o3 = o;
31 o3["street_name"] = "Queen St W";
32
33 auto it = o.find("country");
34 o.insert_or_assign(it,"province","Ontario");
35
36 o.insert_or_assign("unit_type","O");
37
38 std::cout << pretty_print(o) << '\n';
39
40 o.erase("unit_type");
41
42 std::cout << pretty_print(o) << '\n';
43
44 std::cout << '\n';
45}
46

Callers

nothing calls this directly

Calls 5

parseFunction · 0.85
pretty_printFunction · 0.85
insert_or_assignMethod · 0.45
findMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected