Module

JSON.Path

Package
purescript-json
Repository
garyb/purescript-json

#Path Source

data Path

A path to a location in a JSON document.

Constructors

Instances

#get Source

get :: Path -> JSON -> Maybe JSON

Attempts to get the value at the path in a JSON document.

#print Source

print :: Path -> String

Prints the path as a basic JSONPath expression.

#extend Source

extend :: Path -> Path -> Path

Extends the tip of the first path with the second path.

For example, $.data[0] extended with $.info.title would result in $.data[0].info.title.

#findCommonPrefix Source

findCommonPrefix :: Path -> Path -> Path

Finds the common prefix of two paths. If they have nothing in common the result will be the root.

#stripPrefix Source

stripPrefix :: Path -> Path -> Maybe Path

Attempts to strip the first path from the start of the second path. Nothing is returned if the second path does not start with the prefix.

For example, stripping a prefix of $.data[0] from $.data[0].info.title would result in $.info.title.