vertx / io.vertx.core.parsetools / JsonParser

# JsonParser

`interface JsonParser : Handler<Buffer>, ReadStream<JsonEvent>`

A parser class which allows to incrementally parse json elements and emit json parse events instead of parsing a json element fully. This parser is convenient for parsing large json structures. The parser also parses concatenated json streams or line delimited json streams. The parser can also parse entire object or array when it is convenient, for instance a very large array of small objects can be parsed efficiently by handling array start/end and object events. Whenever the parser fails to parse or process the stream, the `#exceptionHandler(Handler)` is called with the cause of the failure and the current handling stops. After such event, the parser should not handle data anymore.

Author
Julien Viet

### Functions

arrayEventMode | `abstract fun arrayEventMode(): JsonParser` Flip the parser to emit a stream of events for each new json array.
arrayValueMode | `abstract fun arrayValueMode(): JsonParser` Flip the parser to emit a single value event for each new json array. Json array currently streamed won't be affected.
end | `abstract fun end(): Unit` End the stream, this must be called after all the json stream has been processed.
endHandler | `abstract fun endHandler(endHandler: Handler<Void>): JsonParser`
exceptionHandler | `abstract fun exceptionHandler(handler: Handler<Throwable>): JsonParser`
handler | `abstract fun handler(handler: Handler<JsonEvent>): JsonParser`
newParser | `open static fun newParser(): JsonParser` `open static fun newParser(stream: ReadStream<Buffer>): JsonParser` Create a new `JsonParser` instance.
objectEventMode | `abstract fun objectEventMode(): JsonParser` Flip the parser to emit a stream of events for each new json object.
objectValueMode | `abstract fun objectValueMode(): JsonParser` Flip the parser to emit a single value event for each new json object. Json object currently streamed won't be affected.
pause | `abstract fun pause(): JsonParser`
resume | `abstract fun resume(): JsonParser`
write | `abstract fun write(buffer: Buffer): JsonParser` Handle a `Buffer`, pretty much like calling `#handle(Object)`.