Releases: discoveryjs/json-ext
Releases · discoveryjs/json-ext
1.0.0
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
0.6.3
0.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 })
0.6.1
0.6.0
- Added
stringifyChunked()as a generator function - 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
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
- 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