0
我正在做一個GET
http請求Google Civic的API,我在那裏提供一個地址並根據提供的地址的位置提供美國政府的接收成員。以JSON格式訪問數據
//var options has the host, path, etc.
var req = https.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk.normalizedInput) //returns 'undefined'
});
});
chunk
被打印了這一點:
而且據我瞭解,訪問normalizedInput
數據,我會做chunk.normalizedInput
,對不對?爲什麼它返回undefined?
這奏效了。謝謝。 – patrickhuang94