norpan/elm-json-patch/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Json.Patch

This module implements JSON Patch as per RFC 6902.

Types

type alias Patch =
List Operation

A Patch is a list of operations that are performed one after another.

= Add Pointer Value
| Remove Pointer
| Replace Pointer Value
| Move Pointer Pointer
| Copy Pointer Pointer
| Test Pointer Value

An operation, as defined by RFC 6902, section 4.

Operation

apply : Patch -> Value -> Result String Value

Apply a Patch to a Value

Operations are applied to the Value in order, and if one operation fails, the whole Patch fails, and an error is returned instead.

Encoder/Decoder

encoder : Patch -> Value

JSON encoder for Patch

decoder : Decoder Patch

JSON decoder for Patch