| 88 | } |
| 89 | |
| 90 | void 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 | |
| 109 | int main() |
| 110 | { |
no test coverage detected