json_mlake ยท API

json.iterator

Structs

JSONIterator

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__

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

def reset(mut self)

Reset iterator to beginning.

size

def size(self) -> Int

Get input data size.

goto_key

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

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

def goto_next_sibling(mut self) -> Int

Move to the next sibling element.

get_value

def get_value(self) -> String

Get the value at the current position.

get_current_char

def get_current_char(self) -> UInt8

Get the character at current structural position.

get_position

def get_position(self) -> Int

Get the current byte position in the input.