aeson-diff-0.1.1.3: 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 

type Path = [Key] Source

A path through a JSON document is a possibly empty sequence of Keys.

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.

data Operation Source

An Operation describes an atomic change to a JSON document: inserting or deleting a single Value at a specific point.

Constructors

Ins

Insert a Value at a location.

Del

Delete the Value at a location.

Functions

diff :: Value -> Value -> Patch Source

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

patch :: Patch -> Value -> Value Source

Apply a patch to a JSON document.

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.