gpt4 book ai didi

java - 从 JsonObject 获取正确的数据

转载 作者:行者123 更新时间:2023-12-01 16:01:37 31 4
gpt4 key购买 nike

从 JsonObject 获取正确的数据..

这是 jsonstring 的样子:

[
{
"EditLink": "http:\/\/localhost:8080\/Service.svc\/A?format=json",
"Item": { "Value": "A" }
},
{
"EditLink": "http:\/\/localhost:8080\/Service.svc\/B?format=json",
"Item": { "Value": "B" }
},
{
"EditLink": "http:\/\/localhost:8080\/Service.svc\/C?format=json",
"Item": { "Value": "C" }
}
]

如何才能只获取值?

最佳答案

如果您想获取值的集合,您可以编写一个例程来执行此操作:

function getItems(jsonArray) {
var list = [];

for (var i = 0; i < jsonArray.length; i++) {
list.push(jsonArray[i].Item.Value);
}

return list;
}

关于java - 从 JsonObject 获取正确的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3729496/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com