/
githubmirror
/
json
Обзор
Документация
Войти
/
githubmirror
/
json
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v3.6.0
doc/examples/diff.cpp
36 строк
705 B
Niels Lohmann
:memo: overworked documentation
16 авг 2018, 22:53
Не верифицирован
16 авг 2018, 22:53
b5c54b4
Код
Авторство
О чём код?
#include <iostream> #include <iomanip> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // the source document json source = R"( { "baz": "qux", "foo": "bar" } )"_json; // the target document json target = R"( { "baz": "boo", "hello": [ "world" ] } )"_json; // create the patch json patch = json::diff(source, target); // roundtrip json patched_source = source.patch(patch); // output patch and roundtrip result std::cout << std::setw(4) << patch << "\n\n" << std::setw(4) << patched_source << std::endl; }