StreamingParser
struct StreamingParserStreaming JSON parser for processing large files.
Reads files in chunks and yields complete JSON values as they become available. Ideal for NDJSON files where each line is independent.
Example: var parser = StreamingParser("large_file.ndjson") while parser.has_next(): var value = parser.next() process(value) parser.close().
Implements Movable
__init__
def __init__(out self, path: String, chunk_size: Int = Int(65536)) Open a file for streaming parsing.
- Args
path: Path to the JSON file.chunk_size: Size of chunks to read (default 64KB).
close
def close(mut self) Close the file handle.
has_next
def has_next(mut self) -> Bool Check if there are more JSON values to read.
next
def next(mut self) -> Value Read and parse the next JSON value.
Raises Error if no more values or parse error.