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

Function jsonpatch_add_add_add_failed1

examples/src/jsonpatch_examples.cpp:44–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void jsonpatch_add_add_add_failed1()
45{
46 json target = json::parse(R"(
47 { "foo": "bar"}
48 )");
49
50 json patch = json::parse(R"(
51 [
52 { "op": "add", "path": "/baz", "value": "qux" },
53 { "op": "add", "path": "/foo", "value": [ "bar", "baz" ] },
54 { "op": "add", "path": "/baz/bat", "value": "qux" } // nonexistent target
55 ]
56 )");
57
58 try
59 {
60 jsonpatch::apply_patch(target, patch);
61 }
62 catch (const jsonpatch::jsonpatch_error& e)
63 {
64 std::cout << "(1) " << e.what() << '\n';
65 std::cout << "(2) " << target << '\n';
66 }
67}
68
69void jsonpatch_add_add_add_failed2()
70{

Callers 1

mainFunction · 0.85

Calls 3

parseFunction · 0.85
apply_patchFunction · 0.85
whatMethod · 0.45

Tested by

no test coverage detected