# JsonTokenParser
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-1)</span>

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.


```pony
class ref JsonTokenParser
```

## Constructors

### create
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-24)</span>


```pony
new ref create(
  notify': JsonTokenNotify ref)
: JsonTokenParser ref^
```
#### Parameters

*   notify': [JsonTokenNotify](json-JsonTokenNotify.md) ref

#### Returns

* [JsonTokenParser](json-JsonTokenParser.md) ref^

---

## Public fields

### var last_number: ([I64](builtin-I64.md) val | [F64](builtin-F64.md) val)
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-18)</span>

The most recently parsed number value.



---

### var last_string: [String](builtin-String.md) val
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-21)</span>

The most recently parsed string or key value.



---

## Public Functions

### parse
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-27)</span>


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

```pony
fun ref parse(
  source': String box)
: None val ?
```
#### Parameters

*   source': [String](builtin-String.md) box

#### Returns

* [None](builtin-None.md) val ?

---

### abort
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-43)</span>


Signal the parser to stop after the current token.

```pony
fun ref abort()
: None val
```

#### Returns

* [None](builtin-None.md) val

---

### token_start
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-47)</span>


Byte offset where the current token starts.

```pony
fun box token_start()
: USize val
```

#### Returns

* [USize](builtin-USize.md) val

---

### token_end
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-51)</span>


Byte offset where the current token ends.

```pony
fun box token_end()
: USize val
```

#### Returns

* [USize](builtin-USize.md) val

---

### line
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-55)</span>


Current line number (1-based).

```pony
fun box line()
: USize val
```

#### Returns

* [USize](builtin-USize.md) val

---

### describe_error
<span class="source-link">[[Source]](src/json/json_token_parser.md#L-0-59)</span>


Human-readable description of the error location.

```pony
fun box describe_error()
: String val
```

#### Returns

* [String](builtin-String.md) val

---

