jspath-0.1: Extract substructures from JSON by following a path.

Text.JSONb.Path

Contents

Description

Extract substructures from JSON structures by following a path.

Synopsis

Building selectors

data Selector Source

Selects an element from a collection. Abstract.

key :: String -> SelectorSource

Select from an Object by key.

idx :: Int -> SelectorSource

Select from an Array by index.

Building paths

data Path Source

A Path is used to traverse a JSON structure and yield zero or more substructures.

Constructors

Fail

Yield nothing.

Yield

Yield this structure.

Selector :=> Path

Select an element and continue on some path.

All Path

Follow a path for each Array element.

Compute (JSON -> Path)

Choose a path programmatically.

Using paths

get :: Path -> JSON -> [JSON]Source

Follow a path to get all matching substructures.

getOne :: Path -> JSON -> Maybe JSONSource

Follow a path to get the first matching substructure.