parseChunked():- Added
returnValueandcurrentRootValueproperties to the state object passed toonChunkandonRootValuecallbacks
- Added
- Exposed internal TypeScript types such as options and return types of public functions as part of the public API
parseChunked():- Refactored from class-based to function-based implementation, as a result a bit smaller and faster
- Added
reviversupport (similar toJSON.parse()), both as a second argument (parseChunked(input, reviver)) and in options (parseChunked(input, { reviver })) - Added support for JSONL (NDJSON) mode, which allows parsing multiple JSON values from a stream of chunks, where each value is separated by a newline character, i.e.
parseChunked(input, { mode }), wheremodecan bejson(default),jsonl, orauto - Added
onRootValueoption for incremental stream processing, useful in JSONL mode, which is called with each parsed root value - Added
onChunkoption for progress tracking - When
onRootValueis specified,parseChunked()returns number of processed root values instead of collecting and returning parsed values - Fixed OOM on very long arrays (corner case, millions of elements)
- Fixed various issues with parsing of malformed JSON
stringifyChunked():- Added
modeoption with"json"(default) and"jsonl"values;mode: "jsonl"serializes iterable input into newline-delimited JSON values
- Added
stringifyInfo():- Added
modeoption with"json"(default) and"jsonl"values;mode: "jsonl"computes byte size for newline-delimited JSON values
- Added
- Fixed an issue with
typesin theexportsofpackage.jsonthat introduced in version0.6.2
- Added
spaceBytesfield tostringifyInfo()result, which indicates the number of bytes used for white spaces. This allows for estimating size ofJSON.stringify()result with and without formatting (whenspaceoption is used) in a single pass instead of two - Fixed
stringifyInfo()to correctly accept thespaceparameter from options, i.e.stringifyInfo(data, { space: 2 })
- Enhanced the performance of
stringifyChunked()by 1.5-3x - Enhanced the performance of
stringifyInfo()by 1.5-5x - Fixed
parseFromWebStream()to ensure that the lock on the reader is properly released
- Added
stringifyChunked()as a generator function (as a replacer forstringifyStream()) - Added
createStringifyWebStream()function - Added
parseFromWebStream()function - Changed
parseChunked()to accept an iterable or async iterable that iterates over string, Buffer, or TypedArray elements - Removed
stringifyStream(), useReadable.from(stringifyChunked())instead - Fixed conformance
stringifyChunked()withJSON.stringify()when replacer a list of keys and a key refer to an entry in a prototype chain stringifyInfo():- Aligned API with
stringifyChunkedby acceptingoptionsas the second parameter. Now supports:stringifyInfo(value, replacer?, space?)stringifyInfo(value, options?)
- Renamed
minLengthfield intobytesin functions result - Removed the
asyncoption - The function result no longer contains the
asyncandduplicatefields - Fixed conformance with
JSON.stringify()when replacer a list of keys and a key refer to an entry in a prototype chain
- Aligned API with
- Discontinued exposing the
versionattribute - Converted to Dual Package, i.e. ESM and CommonJS support
- Fixed adding entire
package.jsoncontent to a bundle when target is a browser
- Fixed
stringifyStream()hang when last element in a stream takes a long time to process (#9, @kbrownlees)
- Added missed TypeScript typings file into the npm package
- Added TypeScript typings (#7, @lexich)
- Fixed
stringifyStream()andstringifyInfo()to work properly when replacer is an allowlist parseChunked()- Fixed wrong parse error when chunks are splitted on a whitespace inside an object or array (#6, @alexei-vedder)
- Fixed corner cases when wrong placed or missed comma doesn't cause to parsing failure
- Fixed
RangeError: Maximum call stack size exceededinparseChunked()on very long arrays (corner case)
- Fixed
parseChunked()crash when input has trailing whitespaces (#4, @smelukov)
- Added support for Node.js 10
- Added
parseChunked()method - Fixed
stringifyInfo()to not throw when meet unknown value type
- Added missed file for build purposes
- Changed build setup to allow building by any bundler that supports
browserproperty inpackage.json - Exposed version
- Renamed
info()method intostringifyInfo() - Fixed lib's distribution setup
- Added
distversion to package (dist/json-ext.jsanddist/json-ext.min.js)
- Fixed main entry point
- Initial release