【发布时间】:2020-02-13 17:38:58
【问题描述】:
我正在尝试从以下 JSON 输出中提取“Automation Admin”,但它给了我 JSONObject["Name"] not found 异常。
我尝试替换 ownerName = json.getJSONArray("records").getJSONObject(i).getString("Name"); with ownerName = json.getJSONArray("records").getJSONObject(i).getString("Owner");但即使这样也失败了。 我可以打印 OwnerId、FirstName 等的值,但不能打印 Name。如何提取“自动化管理员”?
【问题讨论】:
-
它不是根记录对象的字段,而是 Owner 项 - 所以
json.getJSONArray("records").getJSONObject(i).getJSONObject("Owner").getString("Name")或类似的东西 -
那行得通。你拯救了我的一天。谢谢:)
标签: java json rest jsonexception