Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

[Object] node js output


var request = require('request');
request('http://ip-api.com/json', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(response.body);    // Prints the JSON object
    var object = JSON.parse(body);
    console.log(object['country']) // Prints the country value from the JSON object
  }
});

Source by nullorempty.org #
 
PREVIOUS NEXT
Tagged: #node #js #output
ADD COMMENT
Topic
Name
4+5 =