3
寻找组织JSON的解决方案,只请**如何使用org-json库解析json?
假设你处理的结构,如下所示。
使用json-org
,我如何得到一个测试数组,如果整个json在String
s中表示?
使用谷歌的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
}
}
JSONObject o = new JSONObject(s);在这一行我得到了eroor。 “构造函数JSONObject未定义”。 – 2011-06-18 09:43:52
你的情况是什么?应该是String对象,我相信 – JAM 2011-06-18 15:11:50