Skip to content

JsonTokenParser

[Source]

Streaming JSON token parser. Parses a JSON string and emits tokens to a JsonTokenNotify callback. This is the lower-level API — most users should use JsonParser.parse() instead. Use this when you need to process large documents without materializing the full tree.

class ref JsonTokenParser

Constructors

create

[Source]

new ref create(
  notify': JsonTokenNotify ref)
: JsonTokenParser ref^

Parameters

Returns


Public fields

var last_number: (I64 val | F64 val)

[Source]

The most recently parsed number value.


var last_string: String val

[Source]

The most recently parsed string or key value.


Public Functions

parse

[Source]

Parse a JSON document, emitting tokens to the notify callback.

fun ref parse(
  source': String box)
: None val ?

Parameters

Returns


abort

[Source]

Signal the parser to stop after the current token.

fun ref abort()
: None val

Returns


token_start

[Source]

Byte offset where the current token starts.

fun box token_start()
: USize val

Returns


token_end

[Source]

Byte offset where the current token ends.

fun box token_end()
: USize val

Returns


line

[Source]

Current line number (1-based).

fun box line()
: USize val

Returns


describe_error

[Source]

Human-readable description of the error location.

fun box describe_error()
: String val

Returns