请只提供org-json解决方案 **
假设你处理的结构如下所示。
使用 json-org
,如果这整个 JSON 表示为一个 String
s,我该如何获得一个 Tests 数组?
使用 Google 的 gson,通过测试给定对象的类型很容易实现... 我在 json-org
库中错过了一些简单的东西。
{
"Groups":{
"Test":[
{
"Test Number":123456,
"Channel":"TEST",
"environment":"A",
"output event":[
{
"description":"very good description",
"value":123,
"active":true
},
{
"description":"another very good description",
"value":456,
"active":true
}
],
"active":true,
"instrument":"ABC"
},
{
"Test Number":547985,
"Channel":"some new channel",
"environment":"B",
"output event":[
{
"description":"reject",
"value":123,
"active":true
},
{
"description":"ack",
"value":456,
"active":true
}
],
"active":true,
"instrument":"XYZ"
}
],
"name":"A clever name",
"active":true
}
}