
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Parse multiple sequential JSON objects out of a stream.
The module exports a single class:
class MultiJSON {
parse(chunk: string, cb?: (json: unknown) => void): unknown[];
end(cb?: (json: unknown) => void): unknown[];
}
The parse method takes in a string which should be a fragment of a valid JSON object or a series of adjacent JSON objects.
If a callback function is provided, it will be called sychronously once for each complete object that can be deserialized from the input chunks, and parse will return an empty array. If no callback is provided, as many complete objects as possible will be collected from the input and returned in an array. Incomplete objects are preserved across calls; multiple subsequent calls to parse with object fragments will continue to build up the in-progress object until it is complete, after which it will be exposed (either by being passed to the callback or in the return array) in full. The parse method will throw an error with an informative message if it encounters invalid JSON.
The end method forces the MultiJSON object to treat any in-progress object as complete and return it. If a callback is provided, the result object will be both synchronously passed to said callback and returned as the last element of an array. If there is no in-progress object, the callback will not be called. This resets the MultiJSON object to start parsing at the beginning of a new data stream.
If parse throws an error, end may be subsequently called to retrieve any remaining cached objects, as well as the partial value that was being parsed when the error was encountered (if there was any).
In addition to standard JSON, this parser also supports parsing BigInt values with the ES6 BigInt literal syntax.
FAQs
Extract sequential JSON objects from streaming text.
The npm package multijson receives a total of 5 weekly downloads. As such, multijson popularity was classified as not popular.
We found that multijson demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.