diff --git a/week6/13-servi_get_api/servi_http_get.js b/week6/13-servi_get_api/servi_http_get.js index eccea5a..5e86799 100644 --- a/week6/13-servi_get_api/servi_http_get.js +++ b/week6/13-servi_get_api/servi_http_get.js @@ -8,8 +8,9 @@ http.get(url, function(res) { data += chunk; }); res.on("end", function() { - console.log(data); // <-- this is the JSON - // do stuff with the JSON data here + console.log(data); // <-- this is a JSON string + data = JSON.parse(data); // convert string to JSON object + console.log(data.coord); // do stuff with the JSON data here }); }).on("error", function(e) { console.log("Got error: " + e.message);