Go to the documentation of this file.00001 #include <json.hpp>
00002
00003 using json = nlohmann::json;
00004
00005 int main()
00006 {
00007
00008 json doc = R"(
00009 {
00010 "baz": "qux",
00011 "foo": "bar"
00012 }
00013 )"_json;
00014
00015
00016 json patch = R"(
00017 [
00018 { "op": "replace", "path": "/baz", "value": "boo" },
00019 { "op": "add", "path": "/hello", "value": ["world"] },
00020 { "op": "remove", "path": "/foo"}
00021 ]
00022 )"_json;
00023
00024
00025 json patched_doc = doc.patch(patch);
00026
00027
00028 std::cout << std::setw(4) << doc << "\n\n"
00029 << std::setw(4) << patched_doc << std::endl;
00030 }