Why can't you stream a JSON array?
Edit: Here's a (hastily created and untested) node.js example, even:
class JSONArrayStream extends Transform {
constructor() {
super({readableObjectMode: false, writableObjectMode: true});
this.dataWritten = false;
}
_transform(data, encoding, callback) {
if (!this.dataWritten) {
this.dataWritten = true;
this.push('[\n');
this.push(JSON.stringify(data) + '\n');
} else {
this.push(',' + JSON.stringify(data) + '\n');
}
callback();
}
_flush(callback) {
this.push('\n]');
}
}