Skip to content

JsonNode

Defined in: json/json-node.ts:68

A wrapper around unknown that tracks traversal path for lineage.

JsonNode enables typed navigation through JSON structures while maintaining provenance information. Each traversal operation returns a new JsonNode with an extended path, allowing you to trace exactly how you arrived at any value.

Extraction methods return JsonResult which is either a success with the value and its path, or a failure that will abort the pipeline.

get [TYPE_LABEL](): string

Defined in: json/json-node.ts:69

string


get path(): JsonPath

Defined in: json/json-node.ts:88

Returns the current path through the JSON structure.

JsonPath

asArray(): JsonResult<readonly JsonNode[]>

Defined in: json/json-node.ts:221

Extract as an array of JsonNodes.

JsonResult<readonly JsonNode[]>


asBoolean(): JsonResult<boolean>

Defined in: json/json-node.ts:193

Extract as a boolean.

JsonResult<boolean>


asNull(): JsonResult<null>

Defined in: json/json-node.ts:207

Extract as null.

JsonResult<null>


asNumber(): JsonResult<number>

Defined in: json/json-node.ts:179

Extract as a number.

JsonResult<number>


asObject(): JsonResult<Readonly<Record<string, JsonNode>>>

Defined in: json/json-node.ts:236

Extract as an object with JsonNode values.

JsonResult<Readonly<Record<string, JsonNode>>>


asString(): JsonResult<string>

Defined in: json/json-node.ts:165

Extract as a string.

JsonResult<string>


at(index): JsonResult<JsonNode>

Defined in: json/json-node.ts:135

Navigate to an element of an array. Returns a failure if the current value is not an array or index is out of bounds.

number

JsonResult<JsonNode>


get(key): JsonResult<JsonNode>

Defined in: json/json-node.ts:107

Navigate to a property of an object. Returns a failure if the current value is not an object or the key is missing.

string

JsonResult<JsonNode>


has(key): boolean

Defined in: json/json-node.ts:308

Check if the current value (when object) has a specific key.

string

boolean


isArray(): boolean

Defined in: json/json-node.ts:290

Check if the value is an array.

boolean


isBoolean(): boolean

Defined in: json/json-node.ts:276

Check if the value is a boolean.

boolean


isNull(): boolean

Defined in: json/json-node.ts:283

Check if the value is null.

boolean


isNumber(): boolean

Defined in: json/json-node.ts:269

Check if the value is a number.

boolean


isObject(): boolean

Defined in: json/json-node.ts:297

Check if the value is an object (not null, not array).

boolean


isString(): boolean

Defined in: json/json-node.ts:262

Check if the value is a string.

boolean


unwrap(): unknown

Defined in: json/json-node.ts:95

Returns the underlying raw value.

unknown


static from(value): JsonNode

Defined in: json/json-node.ts:81

Creates a JsonNode from a raw unknown.

unknown

JsonNode