Created
January 24, 2012 06:59
-
-
Save Proful/1668595 to your computer and use it in GitHub Desktop.
Reading json file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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