如何使用angular从json提取值? [英] How to extract a value from json using angular?
本文介绍了如何使用angular从json提取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从json [{"status":57}]中提取57?
How do i extract 57 from this json [{"status":57}] in angular?
我尝试了JSON.parse('{"status":57}').status,但会产生错误.
I have tried JSON.parse('{"status":57}').status but produces an error.
推荐答案
[{状态":57}]已经是对象的数组/数组
[{"status":57}] is already an array / array of object
您只需要提取值
data = [{"status":57}];
data[0].status
这篇关于如何使用angular从json提取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文