json_diff v0.1.3 JSONDiff

JSONDiff is an Elixir implementation of the diffing element of the JSON Patch format, described in RFC 6902.

This library only handles diffing. For patching, see the wonderful JSONPatch library.

This library only supports add, replace and remove operations.

It is based on the very fast JavaScript library JSON-Patch

Examples

iex> JSONDiff.diff(%{"a" => 1}, %{"a" => 2})
[%{"op" => "replace", "path" => "/a", "value" => 2}]
iex> JSONDiff.diff([1], [2])
[%{"op" => "replace", "path" => "/0", "value" => 2}]

Installation

# mix.exs
def deps do
  [
    {:json_diff, "~> 0.1.0"}
  ]
end

Link to this section Summary

Link to this section Functions

Link to this function

diff(old, new, patches \\ [], path \\ "")