jsonstream

ModuleIsomorphic

JSON stream parser

Documentation

jsonstreamcallbackfunctionoptionsParserOptionsStreamParser

JSON stream parser. Valid options.type values are 'buffer', 'sax', and 'raw', and the choice determines when callback is called and its arguments.

'buffer' buffers the JSON object in memory and passes it to callback when the stream is closed. If options.parentPath is set to a dot-delimited path to an object or array in the json stream, callback(value, key) is called once for each element of the object or array.

'sax' calls callback as function(token, value), where token is '{', '}', '[', ']', 'key', or 'value'. If token is 'key' or 'value', value is also provided.

'raw' calls callback as function(token, value), where token is '{', '}', '[', ']', ':', ',', 'string', 'number', 'true', 'false', or 'null'. The latter five also provide a decoded value for the token. When the stream is closed, callback is called with no arguments.

StreamParserwritedataArrayBufferstringclosefunction
ParserOptionstype'buffer'stringparentPathstringstring...