Skip to main content

Class: JSONPathNode

Defined in: src/path/nodes.ts:35

A JSON value and its location within a JSON document.

Constructors​

Constructor​

new JSONPathNode(node): JSONPathNode

Defined in: src/path/nodes.ts:41

Parameters​

node​

InternalNode

Returns​

JSONPathNode

Properties​

location​

readonly location: (string | number)[]

Defined in: src/path/nodes.ts:37


value​

readonly value: JSONValue

Defined in: src/path/nodes.ts:36

Accessors​

pointer​

Get Signature​

get pointer(): JSONPointer

Defined in: src/path/nodes.ts:98

A JSON Pointer derived from this node's location.

Returns​

JSONPointer

Methods​

addOp()​

addOp(value): OpObject

Defined in: src/path/nodes.ts:115

Return a JSON Pointer add operation with the path set to this node.

Parameters​

value​

JSONValue

Returns​

OpObject


copyOp()​

copyOp(to): OpObject

Defined in: src/path/nodes.ts:143

Return a JSON Pointer copy operation with from set to this node.

Parameters​

to​

JSONPointer

Returns​

OpObject


moveOp()​

moveOp(to): OpObject

Defined in: src/path/nodes.ts:136

Return a JSON Pointer move operation with from set to this node.

Parameters​

to​

JSONPointer

Returns​

OpObject


normalizedPath()​

normalizedPath(): string

Defined in: src/path/nodes.ts:47

Returns​

string


parentNode()​

parentNode(): JSONPathNode | undefined

Defined in: src/path/nodes.ts:91

Return this node's parent, or undefined if this node is the document root.

Returns​

JSONPathNode | undefined


removeOp()​

removeOp(): OpObject

Defined in: src/path/nodes.ts:122

Return a JSON Pointer remove operation with the path set to this node.

Returns​

OpObject


replaceOp()​

replaceOp(value): OpObject

Defined in: src/path/nodes.ts:129

Return a JSON Pointer replace operation with the path set to this node.

Parameters​

value​

JSONValue

Returns​

OpObject


shorthandPath()​

shorthandPath(): string

Defined in: src/path/nodes.ts:67

Returns​

string


testOp()​

testOp(value): OpObject

Defined in: src/path/nodes.ts:150

Return a JSON Pointer test operation with the path set to this node.

Parameters​

value​

JSONValue

Returns​

OpObject


toPointer()​

toPointer(): JSONPointer

Defined in: src/path/nodes.ts:108

Return this node's location as a JSONPointer.

Returns​

JSONPointer