patch.cpp
Go to the documentation of this file.
00001 #include <json.hpp>
00002 
00003 using json = nlohmann::json;
00004 
00005 int main()
00006 {
00007     // the original document
00008     json doc = R"(
00009         {
00010           "baz": "qux",
00011           "foo": "bar"
00012         }
00013     )"_json;
00014 
00015     // the patch
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     // apply the patch
00025     json patched_doc = doc.patch(patch);
00026 
00027     // output original and patched document
00028     std::cout << std::setw(4) << doc << "\n\n"
00029               << std::setw(4) << patched_doc << std::endl;
00030 }


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:05