您好,我从服务器收到以下响应
{
"Application1": {
"status": "SUCCESS",
"comment": "A123456 added successfully to Application"
},
"Application2": {
"status": "SUCCESS",
"comment": "B67890 added successfully to Application"
}
}
我需要根据状态显示一条消息,我们正在使用 Angular 和 javascript 我无法循环读取相同的内容,我们将不胜感激
最佳答案
我能想到的最简单的版本:
<script>
var json = {"Application1":{"status":"SUCCESS","comment":"A123456 added successfully to Application"},"Application2":{"status":"SUCCESS","comment":"B67890 added successfully to Application"}};
for(var t in json)
console.log(json[t]['status']);
</script>
关于javascript - 使用 Javascript/Angular 读取 JSON 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30388959/