Skip to content

Instantly share code, notes, and snippets.

@Proful
Created January 24, 2012 06:59
Show Gist options
  • Select an option

  • Save Proful/1668595 to your computer and use it in GitHub Desktop.

Select an option

Save Proful/1668595 to your computer and use it in GitHub Desktop.
Reading json file
var http = require("http");
var options = {
host: 'vps.someoneweird.net',
port: 3000
};
http.get(options, function(res){
var data = "";
res.on('data',function(chunk){
data += chunk;
});
res.on('end', function(){
data = JSON.parse(data);
var item = data[0];
item.addresses.forEach(function(element){
console.log(element);
})
})
}).on('error', function(err){
console.log(err.message);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment