norpan / elm-json-patch / Json.Pointer

This module implements JSON Pointer as per RFC 6901.

Type


type alias Pointer =
List String

A type alias representing a JSON Pointer.

The JSON string "/a/b/c" corresponds to [ "a", "b", "c" ]

Operations

addAt : Pointer -> Json.Decode.Value -> Json.Decode.Value -> Result String Json.Decode.Value

Add the specified value at the specified pointer.

For adding to an array, this means inserting the value at the specified index , shifting the following elements to the right.

For adding to an object, this means adding or replacing the specified field.

removeAt : Pointer -> Json.Decode.Value -> Result String Json.Decode.Value

Remove the specified value at the specified pointer.

For removing from an array, this means deleting the value at the specified index , shifting the following elements to the left.

For removing from an object, this means removing the specified field.

getAt : Pointer -> Json.Decode.Value -> Result String Json.Decode.Value

Get the Value at the specified pointer.

Encoder/Decoder

encoder : Pointer -> Json.Encode.Value

JSON encoder for Pointer

decoder : Json.Decode.Decoder Pointer

JSON decoder for Pointer