diff.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 source document
00008     json source = R"(
00009         {
00010             "baz": "qux",
00011             "foo": "bar"
00012         }
00013     )"_json;
00014 
00015     // the target document
00016     json target = R"(
00017         {
00018             "baz": "boo",
00019             "hello": [
00020                 "world"
00021             ]
00022         }
00023     )"_json;
00024 
00025     // create the patch
00026     json patch = json::diff(source, target);
00027 
00028     // roundtrip
00029     json patched_source = source.patch(patch);
00030 
00031     // output patch and roundtrip result
00032     std::cout << std::setw(4) << patch << "\n\n"
00033               << std::setw(4) << patched_source << std::endl;
00034 }


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