aeson-diff-1.1.0.8: Extract and apply patches to JSON documents.
Safe HaskellNone
LanguageHaskell2010

Data.Aeson.Diff

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

newtype Patch Source #

Describes the changes between two JSON documents.

Constructors

Patch 

Instances

Instances details
Eq Patch Source # 
Instance details

Defined in Data.Aeson.Patch

Methods

(==) :: Patch -> Patch -> Bool

(/=) :: Patch -> Patch -> Bool

Show Patch Source # 
Instance details

Defined in Data.Aeson.Patch

Methods

showsPrec :: Int -> Patch -> ShowS

show :: Patch -> String

showList :: [Patch] -> ShowS

Semigroup Patch Source # 
Instance details

Defined in Data.Aeson.Patch

Methods

(<>) :: Patch -> Patch -> Patch

sconcat :: NonEmpty Patch -> Patch

stimes :: Integral b => b -> Patch -> Patch

Monoid Patch Source # 
Instance details

Defined in Data.Aeson.Patch

ToJSON Patch Source # 
Instance details

Defined in Data.Aeson.Patch

FromJSON Patch Source # 
Instance details

Defined in Data.Aeson.Patch

data Pointer Source #

Pointer to a location in a JSON document.

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

Instances

Instances details
Eq Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

Methods

(==) :: Pointer -> Pointer -> Bool

(/=) :: Pointer -> Pointer -> Bool

Ord Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

Methods

compare :: Pointer -> Pointer -> Ordering

(<) :: Pointer -> Pointer -> Bool

(<=) :: Pointer -> Pointer -> Bool

(>) :: Pointer -> Pointer -> Bool

(>=) :: Pointer -> Pointer -> Bool

max :: Pointer -> Pointer -> Pointer

min :: Pointer -> Pointer -> Pointer

Show Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

Methods

showsPrec :: Int -> Pointer -> ShowS

show :: Pointer -> String

showList :: [Pointer] -> ShowS

Semigroup Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

Methods

(<>) :: Pointer -> Pointer -> Pointer

sconcat :: NonEmpty Pointer -> Pointer

stimes :: Integral b => b -> Pointer -> Pointer

Monoid Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

ToJSON Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

FromJSON Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

data Key Source #

Path components to 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.

Instances

Instances details
Eq Key Source # 
Instance details

Defined in Data.Aeson.Pointer

Methods

(==) :: Key -> Key -> Bool

(/=) :: Key -> Key -> Bool

Ord Key Source # 
Instance details

Defined in Data.Aeson.Pointer

Methods

compare :: Key -> Key -> Ordering

(<) :: Key -> Key -> Bool

(<=) :: Key -> Key -> Bool

(>) :: Key -> Key -> Bool

(>=) :: Key -> Key -> Bool

max :: Key -> Key -> Key

min :: Key -> Key -> Key

Show Key Source # 
Instance details

Defined in Data.Aeson.Pointer

Methods

showsPrec :: Int -> Key -> ShowS

show :: Key -> String

showList :: [Key] -> ShowS

ToJSON Key Source # 
Instance details

Defined in Data.Aeson.Pointer

FromJSON Key Source # 
Instance details

Defined in Data.Aeson.Pointer

data Operation Source #

An Operation describes the operations which can appear as part of a JSON Patch.

See RFC 6902 Section 4 http://tools.ietf.org/html/rfc6902#section-4.

Instances

Instances details
Eq Operation Source # 
Instance details

Defined in Data.Aeson.Patch

Methods

(==) :: Operation -> Operation -> Bool

(/=) :: Operation -> Operation -> Bool

Show Operation Source # 
Instance details

Defined in Data.Aeson.Patch

Methods

showsPrec :: Int -> Operation -> ShowS

show :: Operation -> String

showList :: [Operation] -> ShowS

ToJSON Operation Source # 
Instance details

Defined in Data.Aeson.Patch

FromJSON Operation Source # 
Instance details

Defined in Data.Aeson.Patch

newtype Config Source #

Configuration for the diff algorithm.

Constructors

Config 

Fields

Functions

diff :: Value -> Value -> Patch Source #

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

Uses the defaultConfig.

diff' :: Config -> 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.