How to add second property at JSONStream.parse()?
opened this issue · comments
I want to parse big json file and get from it two property how can i do this?
like i choose one
var parser = JSONStream.parse('email'), how can i add another one?
` var getStream = function () {
var stream = fs.createReadStream(fileName, {encoding: 'utf8'});
var parser = JSONStream.parse('email'); // how to add here another
return stream.pipe(parser);
};
getStream()
.pipe(es.mapSync(function (data) {
console.log(data);
}));
`
my code
JSONStream works best with list like data. Hopefully your json file is at some level, a very large array with many item.
you give JSONStream.parse(...)
a path into the json object... maybe something like "rows.*.email"
if you had a document that looked like {"rows": [....{email: foo@bar.com, ...}]}
if you need to get two properties, just take a path to the level they are in. say, rows.*
yeah, i do the same already, thanks