yajl-0.1: Bindings for YAJL, an event-based JSON implementation

Text.JSON.YAJL

Contents

Synopsis

Parser

data ParserCallbacks Source

Each callback should return True to continue parsing, or False to cancel.

data ParseStatus Source

Constructors

ParseFinished 
ParseContinue

More input is required before parsing can complete.

ParseCancelled

A callback returned False.

ParseError Text

An error occured while parsing. The included message contains details about the error.

parseComplete :: Parser -> IO ParseStatusSource

Indicate that no more input is available, and parse any remaining buffered input.

getBytesConsumed :: Parser -> IO IntegerSource

Get the number of bytes consumed from the last input chunk.

Note that if using parseText, this corresponds to UTF-8 bytes, not characters.

If the most recent call to parseUTF8 or parseText returned ParseFinished, this will indicate whether there are any un-parsed bytes past the end of input.

If the most recent parse returned ParseError, this will indicate where the error occured.

Generator

data GeneratorConfig Source

Constructors

GeneratorConfig 

Fields

generatorBeautify :: Bool

Whether to generate indented, whitespaced output.

generatorIndent :: Text

How much to indent beautified output by. This is only used if generatorBeautify is True.

data GeneratorError Source

If an error is encountered when generating data, a GeneratorError will be thrown.

With the exception of MaximumDepthExceeded, this is usually due to incorrect use of the library.

newGenerator :: GeneratorConfig -> IO GeneratorSource

Create a new, empty generator with the given configuration.

getBuffer :: Generator -> IO ByteStringSource

Retrieve the NUL-terminated byte buffer.

clearBuffer :: Generator -> IO ()Source

Clear the generator's output buffer. This does not change the state of the generator.

Generator events