# json.iterator

> A module of json_mlake's API.

## Structs

### `JSONIterator`

```mojo
struct JSONIterator
```

Iterator for traversing parsed JSON structure.

Provides APIs to navigate the parsed JSON tree efficiently.
The pre-calculated pair_pos enables O(1) skipping of nested structures.

Implements: `Movable`

Fields:

- `result: JSONResult`
- `input_data: List[UInt8]`
- `current_pos: Int`

#### `__init__`

```mojo
def __init__(out self, var result: JSONResult, var input_data: List[UInt8])
```

Initialize iterator with parsed result.

Args:

- `result`: The parsed JSON result.
- `input_data`: Original JSON data.

#### `reset`

```mojo
def reset(mut self)
```

Reset iterator to beginning.

#### `size`

```mojo
def size(self) -> Int
```

Get input data size.

#### `goto_key`

```mojo
def goto_key(mut self, key: String) -> Int
```

Move to the value associated with a key in the current object.

Args:

- `key`: The key to search for.

#### `goto_array_index`

```mojo
def goto_array_index(mut self, index: Int) -> Int
```

Move to element at index in the current array.

Args:

- `index`: Zero-based index in the array.

#### `goto_next_sibling`

```mojo
def goto_next_sibling(mut self) -> Int
```

Move to the next sibling element.

#### `get_value`

```mojo
def get_value(self) -> String
```

Get the value at the current position.

#### `get_current_char`

```mojo
def get_current_char(self) -> UInt8
```

Get the character at current structural position.

#### `get_position`

```mojo
def get_position(self) -> Int
```

Get the current byte position in the input.
