Sunday 28 May 2017

Sort JSON file with NODEJS

I just started using NodeJS (as of yesterday) I have managed to retrieve JSON data from an API as seen in the code below:

var request = require('request');
var fs = require('fs');
const pug = require('pug');

request.get('APICALL', function(err, data) {
if (err) { }
else {



console.log(data);

fs.writeFile('industries.txt', JSON.stringify(data));

}
});

The JSON data that my request.get returns can be found here JSON FILE

What I want to do is sort through this data, find out which revenue and industry ID appears the most (i.e for this data it's "revenue:8" and "industry:69") once this is done I want to return only companies who match both revenue 8 and industry 9.

Is this possible and what would be the best way to approach such a task?



via user3679330

No comments:

Post a Comment