JSONStream (GitHub: dominictarr/JSONStream, License: Apache) is a module by Dominic Tarr for streaming JSON.parse and JSON.stringify.

npm install jsonstream


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

var parser = JSONStream.parse(['rows', true]),
    req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'}),
    logger = es.mapSync(function (data) {
      return data;

request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
  .pipe(es.mapSync(function (data) {
    return data;

I like the idea behind streaming JSON alot because you don’t have to wait for the whole document to come down the pipe, especially if it’s very large. It can also integrate with gulp.js very nicely. The really cool thing for me is that you can react to specific nodes in the data structure vs having to seek them out and loop over them manually.

Are you dealing with large JSON structures on your project?