0
我有像下面給出的JSON數組。如何根據其鍵獲取值?如何在java中使用它的鍵獲取Json值?
$>
[{Work
> Group=[{"id":"wNUvBiv5tQDFphP3zITN5NDEqyXJM8W2","errRsn":["Response
> time from Sweden exceeded 1500 ms."],"ap":"100.0
> %","status":"Trouble","name":"Site24x7","rsptime":"1549
> ms","downs":"0","tDwn":"5 Hrs 50 Mins
> ","conf":"no","mtype":"URL","monitorid":"2c2d1ba5b57d9c1be8fcae5522b5bb9f","lsDur":"-","lsDwn":""},{"id":"wNUvBiv5tQB1kKQSZBij\/b8FU++kkoRh","ap":"100.0
> %","status":"Up","name":"Site24x7 WPA","rsptime":"424
> ms","downs":"0","conf":"no","mtype":"HOMEPAGE","monitorid":"58e79381158d85e8eb944ec5506db09a","lsDur":"-"},{"id":"wNUvBiv5tQD\/DIkhHWufnTRJzbcIgZk4","rspvalue":"-","downReason":"Unknown
> Host","status":"Down","name":"Site24x7","tDwn":"62 days 17 Hrs 7 Mins
> ","conf":"yes","mtype":"PORT","monitorid":"6cacfbf47ad21d824006be1168efc3c6","lsDwn":"2012-09-18"},{"id":"wNUvBiv5tQCBw1RAuk0Q2P1FZPxXxMr1","downReason":"Trouble
> invoking
> url(https:\/\/www.site24x7.com\/login\/UserAction.do?execute=checkConfirmedAccount).<br\/>Internal
> Server Error","ap":"0.0 %","status":"Down","name":"Web App
> Monitor","rsptime":"- ms","downs":"1","tDwn":"151 days 19 Hrs 8 Mins
> ","conf":"no","mtype":"URL-SEQ","monitorid":"6d887f7adeba3801b1313a4b7e0997c8","lsDur":"1
> days 0 Hrs 0 Mins ","lsDwn":"2012-06-21"}]}]
請把代碼JSON格式! –
您可以使用[jsbeautifier](http://jsbeautifier.org/)進行格式設置。正如我所看到的結果是不同的。例如檢查lsDur和lsDwn字段。這是一個錯誤嗎? – saji159
第二件事WorkGroup ='應該更改爲'「WorkGroup」:'。你可以使用[jsonlint](http://jsonlint.com/)valide JSON。 – saji159