json-query-0.2.3.1: Kitchen sink for querying JSON
Safe HaskellSafe-Inferred
LanguageHaskell2010

Json.Context

Synopsis

Documentation

data Context Source #

A finger into a json value indicating where a parser is currently operating. When a parser focuses on a key-value pair in a map, it adds Key constructor to the context, and when it focuses on an element of an array, it adds an Index constructor. Like all zipper-like data structures, it is, in a sense, reversed, which makes it cheap to construct while parsing.

Constructors

Top 
Key !ShortText !Context 
Index !Int !Context 

Instances

Instances details
Show Context Source # 
Instance details

Defined in Json.Context

Eq Context Source # 
Instance details

Defined in Json.Context

Methods

(==) :: Context -> Context -> Bool #

(/=) :: Context -> Context -> Bool #

Encoding

builderUtf8 :: Context -> Builder Source #

Convert Context to textual representation using UTF-8 as the encoding scheme. This reverses the context to present it in the expected order.

Conversion

toPath :: Context -> Path Source #

Reverse the context, converting it to a Path. For example, toPath performs this conversion:

12.bar.foo.Top ==> foo.bar.12.Nil