[#nlohmann-basic_json-0c-diff] = xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-0c.adoc[basic_json]::diff :relfileprefix: ../../ :mrdocs: creates a diff as a JSON patch == Synopsis Declared in `<nlohmann/json.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] static xref:nlohmann/basic_json-0c.adoc[basic_json] diff( xref:nlohmann/basic_json-0c.adoc[basic_json] const& source, xref:nlohmann/basic_json-0c.adoc[basic_json] const& target, xref:nlohmann/basic_json-0c/string_t.adoc[string_t] const& path = ""); ---- == Return Value a JSON Patch (RFC 6902) document describing the changes needed to turn _source_ into _target_ [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *source* | JSON value to compare from | *target* | JSON value to compare against | *path* | JSON Pointer path prefixed to the paths of the generated operations |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#