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