aeson-diff-1.0.0.0: Extract and apply patches to JSON documents.

Safe HaskellNone
LanguageHaskell2010

Data.Aeson.Diff

Contents

Description

This module implements data types and operations to represent the differences between JSON documents (i.e. a patch), to compare JSON documents and extract such a patch, and to apply such a patch to a JSON document.

Synopsis

Patches

data Patch Source

Describes the changes between two JSON documents.

Constructors

Patch 

data Pointer Source

Pointer to a location in a JSON document.

Defined in RFC 6901 http://tools.ietf.org/html/rfc6901

data Key Source

Traverse a single layer of a JSON document.

Constructors

OKey Text

Traverse a Value with an Object constructor.

AKey Int

Traverse a Value with an Array constructor.

Functions

diff :: Value -> Value -> Patch Source

Compare two JSON documents and generate a patch describing the differences.

patch :: Patch -> Value -> Result Value Source

Apply a patch to a JSON document.

patch' :: Patch -> Value -> Value Source

Apply a patch to a JSON document.

If the patch cannot be cleanly applied an error is thrown.

formatPatch :: Patch -> Text Source

Format a Patch for reading by humans.

For storing or exchanging Patches between systems using the JSON encoding implemented by the FromJSON and ToJSON instances.