Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 11, 2024 via pnpm

JSONStream 1.2.1

rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)
Package summary
Share
0
issues
2
licenses
2
MIT
1
(MIT OR Apache-2.0)
Package created
23 Sep 2011
Version published
24 Sep 2016
Maintainers
14
Total deps
3
Direct deps
2
License
(MIT OR Apache-2.0)

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
jsonparse@1.3.1
through@2.3.8

(MIT OR Apache-2.0)

Permissive
1 Packages, Including:
JSONStream@1.2.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of JSONStream 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
jsonparse1.3.18.35 kBMIT
prod
through2.3.84.36 kBMIT
prod

Visualizations

Frequently Asked Questions

What does JSONStream do?

JSONStream is a node.js package that allows for streaming of JSON.parse and stringify. It allows the parsing and stringifying of JSON data in a way that's memory-efficient and fast, making it ideal for use when dealing with particularly large JSON objects.

How do you use JSONStream?

To use JSONStream, you first need to install it by running npm install JSONStream in the command line. Once you've installed the package, you can require it in your node.js project.

Here's an example of its usage:

var request = require('request')
var JSONStream = require('JSONStream')
var es = require('event-stream')

request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
.pipe(JSONStream.parse('rows.*'))
.pipe(es.mapSync(function (data) {
    console.error(data)
    return data
}))

In this code snippet, JSONStream is used to parse data from a URL 'http://isaacs.couchone.com/registry/_all_docs'. Then it looks for JSON objects that match the 'rows.*' pattern and pipes them through an event-stream which logs the data to the console. To match a child at any depth, you can use the .. operator, which is the recursive descent operator.

You can also use a function to map or filter the JSON output. The map function would be passed the value at that node of the pattern and if the map returns non-nullish, that value will be emitted in the stream.

Here is an another example with more depth:

var stream = JSONStream.parse(['rows', true, 'doc', {emitKey: true}]) //rows, ANYTHING, doc, items in docs with keys

stream.on('data', function(data) {
  console.log('key:', data.key);
  console.log('value:', data.value);
});

Where are the JSONStream docs?

For JSONStream documentations, one can refer to the README available at the package's GitHub repository here. The README file offers extensive guidance on how to use the module, including various examples and different uses of methods. You can also visit NPM's webpage for JSONStream here for more information and usage examples.