简体   繁体   English

Node.js 无法获取 JSON 对象属性

[英]Node.js can't get JSON Object property

I'm using Node v6.5.0.我正在使用 Node v6.5.0。 I have a JSON Object as the response of HTTP request and I need to get the body property.我有一个 JSON 对象作为 HTTP 请求的响应,我需要获取 body 属性。 However if I try to get the body using res.body , I will get completely messed up result.但是,如果我尝试使用res.body获取身体,我会得到完全搞砸的结果。

Because the JSON Object is too long, I can't post it here.因为JSON Object 太长了,不能贴在这里。 Follows is the link of coderpad containing the JSON Object and the result when I access the body property以下是包含 JSON 对象的 coderpad 链接以及访问 body 属性时的结果

https://coderpad.io/6RNEMTJ3 https://coderpad.io/6RNEMTJ3

The only body I can see in your coderpad link seems to be a string containing HTML.我在您的 coderpad 链接中看到的唯一正文似乎是一个包含 HTML 的字符串。 Which can't be parsed as JSON.无法解析为 JSON。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM