jsonpath-0.3.0.0: Library to parse and execute JSONPath

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.JSONPath.Types

Synopsis

- data BeginningPoint
  - = Root
  - | CurrentObject
- data Condition
  - = Equal
  - | NotEqual
  - | GreaterThan
  - | SmallerThan
  - | GreaterThanOrEqual
  - | SmallerThanOrEqual
- data Comparable
  - = CmpNumber Scientific
  - | CmpString Text
  - | CmpBool Bool
  - | CmpNull
  - | CmpPath SingularPath
- data JSONPathElement
  - = KeyChild Text
  - | IndexChild Int
  - | AnyChild
  - | Slice (Maybe Int) (Maybe Int) (Maybe Int)
  - | Union [UnionElement]
  - | Filter FilterExpr
  - | Search [JSONPathElement]
- data UnionElement
  - = UEKeyChild Text
  - | UEIndexChild Int
  - | UESlice (Maybe Int) (Maybe Int) (Maybe Int)
- data FilterExpr
  - = ExistsExpr SingularPath
  - | ComparisonExpr Comparable Condition Comparable
  - | And FilterExpr FilterExpr
  - | Or FilterExpr FilterExpr
  - | Not FilterExpr
- data SingularPathElement
  - = Key Text
  - | Index Int
- data SingularPath = SingularPath BeginningPoint [SingularPathElement]

# Documentation

data BeginningPoint Source #

Constructors

Root |
CurrentObject |

#### Instances

Instances details

Show BeginningPoint Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> BeginningPoint -> ShowS Source # show :: BeginningPoint -> String Source # showList :: [BeginningPoint] -> ShowS Source #
Eq BeginningPoint Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: BeginningPoint -> BeginningPoint -> Bool Source # (/=) :: BeginningPoint -> BeginningPoint -> Bool Source #

data Condition Source #

Constructors

Equal |
NotEqual |
GreaterThan |
SmallerThan |
GreaterThanOrEqual |
SmallerThanOrEqual |

#### Instances

Instances details

Show Condition Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> Condition -> ShowS Source # show :: Condition -> String Source # showList :: [Condition] -> ShowS Source #
Eq Condition Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: Condition -> Condition -> Bool Source # (/=) :: Condition -> Condition -> Bool Source #

data Comparable Source #

Constructors

CmpNumber Scientific |
CmpString Text |
CmpBool Bool |
CmpNull |
CmpPath SingularPath |

#### Instances

Instances details

Show Comparable Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> Comparable -> ShowS Source # show :: Comparable -> String Source # showList :: [Comparable] -> ShowS Source #
Eq Comparable Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: Comparable -> Comparable -> Bool Source # (/=) :: Comparable -> Comparable -> Bool Source #

data JSONPathElement Source #

A `JSONPath` is a list of `JSONPathElement`s.

Constructors

KeyChild Text | '$.foo' or '$["foo"]'
IndexChild Int | '$[1]'
AnyChild | '$[*]'
Slice (Maybe Int) (Maybe Int) (Maybe Int) | '$[1:7]', '$[0:10:2]', '$[::2]', '$[::]', etc.
Union [UnionElement] | '$[0,1,9]' or '$[0, 1:2, "foo", "bar"]'
Filter FilterExpr | '$[?(`.foo == 42)]', '$[?(`.foo > @.bar)]', etc.
Search [JSONPathElement] | '$..foo.bar'

#### Instances

Instances details

Show JSONPathElement Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> JSONPathElement -> ShowS Source # show :: JSONPathElement -> String Source # showList :: [JSONPathElement] -> ShowS Source #
Eq JSONPathElement Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: JSONPathElement -> JSONPathElement -> Bool Source # (/=) :: JSONPathElement -> JSONPathElement -> Bool Source #

data UnionElement Source #

Elements which can occur inside a union

Constructors

UEKeyChild Text |
UEIndexChild Int |
UESlice (Maybe Int) (Maybe Int) (Maybe Int) |

#### Instances

Instances details

Show UnionElement Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> UnionElement -> ShowS Source # show :: UnionElement -> String Source # showList :: [UnionElement] -> ShowS Source #
Eq UnionElement Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: UnionElement -> UnionElement -> Bool Source # (/=) :: UnionElement -> UnionElement -> Bool Source #

data FilterExpr Source #

Constructors

ExistsExpr SingularPath |
ComparisonExpr Comparable Condition Comparable |
And FilterExpr FilterExpr |
Or FilterExpr FilterExpr |
Not FilterExpr |

#### Instances

Instances details

Show FilterExpr Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> FilterExpr -> ShowS Source # show :: FilterExpr -> String Source # showList :: [FilterExpr] -> ShowS Source #
Eq FilterExpr Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: FilterExpr -> FilterExpr -> Bool Source # (/=) :: FilterExpr -> FilterExpr -> Bool Source #

data SingularPathElement Source #

Constructors

Key Text |
Index Int |

#### Instances

Instances details

Show SingularPathElement Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> SingularPathElement -> ShowS Source # show :: SingularPathElement -> String Source # showList :: [SingularPathElement] -> ShowS Source #
Eq SingularPathElement Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: SingularPathElement -> SingularPathElement -> Bool Source # (/=) :: SingularPathElement -> SingularPathElement -> Bool Source #

data SingularPath Source #

A JSONPath which finds at max one value, given a beginning point. Used by `FilterExpr` for `ExistsExpr` and `ComparisonExpr`.

Constructors

SingularPath BeginningPoint [SingularPathElement] |

#### Instances

Instances details

Show SingularPath Source # |
Instance details Defined in Data.JSONPath.Types Methods showsPrec :: Int -> SingularPath -> ShowS Source # show :: SingularPath -> String Source # showList :: [SingularPath] -> ShowS Source #
Eq SingularPath Source # |
Instance details Defined in Data.JSONPath.Types Methods (==) :: SingularPath -> SingularPath -> Bool Source # (/=) :: SingularPath -> SingularPath -> Bool Source #