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

Function create_a_json_patch

examples/src/jsonpatch_examples.cpp:90–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void create_a_json_patch()
91{
92 json source = json::parse(R"(
93 {"/": 9, "foo": "bar"}
94 )");
95
96 json target = json::parse(R"(
97 { "baz":"qux", "foo": [ "bar", "baz" ]}
98 )");
99
100 auto patch = jsonpatch::from_diff(source, target);
101
102 std::error_code ec;
103 jsonpatch::apply_patch(source, patch, ec);
104
105 std::cout << "(1)\n" << pretty_print(patch) << '\n';
106 std::cout << "(2)\n" << pretty_print(source) << '\n';
107}
108
109int main()
110{

Callers 1

mainFunction · 0.85

Calls 4

parseFunction · 0.85
apply_patchFunction · 0.85
pretty_printFunction · 0.85
from_diffFunction · 0.50

Tested by

no test coverage detected