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

newtype Patch Source #

Describes the changes between two JSON documents.

Constructors

Patch 
Instances
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 #

Generic Patch Source # 
Instance details

Defined in Data.Aeson.Patch

Associated Types

type Rep Patch :: Type -> Type #

Methods

from :: Patch -> Rep Patch x #

to :: Rep Patch x -> Patch #

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

Methods

mempty :: Patch #

mappend :: Patch -> Patch -> Patch #

mconcat :: [Patch] -> Patch #

ToJSON Patch Source # 
Instance details

Defined in Data.Aeson.Patch

FromJSON Patch Source # 
Instance details

Defined in Data.Aeson.Patch

type Rep Patch Source # 
Instance details

Defined in Data.Aeson.Patch

type Rep Patch = D1 (MetaData "Patch" "Data.Aeson.Patch" "aeson-diff-1.1.0.9-361i0zGlNlKELB5hftzYU1" True) (C1 (MetaCons "Patch" PrefixI True) (S1 (MetaSel (Just "patchOperations") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Operation])))

data Pointer Source #

Pointer to a location in a JSON document.

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

Instances
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

Show Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

Generic Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

Associated Types

type Rep Pointer :: Type -> Type #

Methods

from :: Pointer -> Rep Pointer x #

to :: Rep Pointer x -> Pointer #

Semigroup Pointer Source # 
Instance details

Defined in Data.Aeson.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

type Rep Pointer Source # 
Instance details

Defined in Data.Aeson.Pointer

type Rep Pointer = D1 (MetaData "Pointer" "Data.Aeson.Pointer" "aeson-diff-1.1.0.9-361i0zGlNlKELB5hftzYU1" True) (C1 (MetaCons "Pointer" PrefixI True) (S1 (MetaSel (Just "pointerPath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Path)))

data Key Source #

Path components to traverse a single layer of a JSON document.

Constructors

OKey Text

Traverse a Value with an Value constructor.

AKey Int

Traverse a Value with an Value constructor.

Instances
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 #

Generic Key Source # 
Instance details

Defined in Data.Aeson.Pointer

Associated Types

type Rep Key :: Type -> Type #

Methods

from :: Key -> Rep Key x #

to :: Rep Key x -> Key #

ToJSON Key Source # 
Instance details

Defined in Data.Aeson.Pointer

FromJSON Key Source # 
Instance details

Defined in Data.Aeson.Pointer

type Rep 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
Eq Operation Source # 
Instance details

Defined in Data.Aeson.Patch

Show Operation Source # 
Instance details

Defined in Data.Aeson.Patch

Generic Operation Source # 
Instance details

Defined in Data.Aeson.Patch

Associated Types

type Rep Operation :: Type -> Type #

ToJSON Operation Source # 
Instance details

Defined in Data.Aeson.Patch

FromJSON Operation Source # 
Instance details

Defined in Data.Aeson.Patch

type Rep Operation Source # 
Instance details

Defined in Data.Aeson.Patch

newtype Config Source #

Configuration for the diff algorithm.

Constructors

Config 

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.