I am new at working with JSON objects and I have been trying to find an answer on here but the common method I have seen being used is not working for me.
I am trying to get the value 21 from the JSON object I can inspect in my javascript console.
^Object { number: Object }
^number: Object
min: 21
>_proto_: Object
The name of the JSON object is answer
so I tried to use JSON.parse
obj = JSON.parse(answer);
console.log(answer.min);
Or this
obj = JSON.parse(answer);
console.log(answer.number.min);
I know I'm missing something simple but I'm a visual learner and the docs don't do much for me.
我从另一篇文章中看到了评论字段,并且如果答案确实只是一个对象,那么以下内容应该起作用。
obj = answer.number.min
我猜你需要obj.number.min
,如果answer
是一个字符串。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.