JSONTokenizer

An object used to parse JSON items from a given iopipe chain. As the items are parsed, the structure of the JSON data is validated. Note that the data returned is simply references to within the iopipe window.

Each new item/token can be obtained by calling the next method.

Members

Functions

endCache
void endCache()

stop caching elements (the cache will be freed when no longer needed)

next
JSONItem next()

Obtain the next JSONItem from the stream.

parseTo
bool parseTo(string[] submember)
Undocumented in source. Be warned that the author may not have intended to support it.
peek
JSONToken peek()

Peek at the input stream and see what's coming next.

release
void release(size_t elements)

Release the given number of stream elements from the stream. Note: you are only allowed to release elements that are ALREADY parsed.

releaseParsed
size_t releaseParsed()

Release all elements that have been parsed completely. The return value is the number of elements that were released. Note that this can be done at any point, it doesn't matter if the parser is partway through an object, the rest of that object can still be parsed.

rewind
void rewind()
Undocumented in source. Be warned that the author may not have intended to support it.
skipItem
JSONItem skipItem()
Undocumented in source. Be warned that the author may not have intended to support it.
startCache
void startCache()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

finished
bool finished [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
position
size_t position [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

chain
Chain chain;

The iopipe source. Use this to parse the data returned. Do not call chain.release directly, use the release method instead to make sure the internal state is maintained.

Meta