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

Text.JSON.YAJL

Contents

Synopsis

Parser

data Parser s Source

data ParserCallbacks s 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 s -> ST s ParseStatusSource

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

getBytesConsumed :: Parser s -> ST s 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 -> ST s (Generator s)Source

Create a new, empty generator with the given configuration.

getBuffer :: Generator s -> ST s ByteStringSource

Retrieve the NUL-terminated byte buffer.

clearBuffer :: Generator s -> ST s ()Source

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

Generator events