0

我在解析从 Query for products in Google Product 收到的数据时遇到问题。如果我运行类似于...的查询

curl --header "Authorization:GoogleLogin Auth=<AuthKey>" --header "Content-Type:application/atom+xml" https://content.googleapis.com/content/v1/8076653/items/products/generic?alt=json

我收到一个 JSON(ish?) 文档,类似于以下内容

{
  "version":"1.0",
  "encoding":"UTF-8",
  "feed":{
  ...
  }
}

但是当我运行以下

res.on('end', function() {
  console.log(res.body.feed);
  mainRes.send(res.body);
});

控制台显示未定义。

4

1 回答 1

0

应该...

res.on('end', function() {
  console.log(JSON.parse(res.body).feed);
  mainRes.send(res.body);
});
于 2012-07-16T19:40:40.540 回答