creates a diff as a JSON patch

Synopsis

Declared in <nlohmann/json.hpp>

[[nodiscard]]
static
basic_json
diff(
    basic_json const& source,
    basic_json const& target,
    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 should not be discarded.

Parameters

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

Created with MrDocs