1
IM序列化JSON有效載荷再次使用JSON掙扎:( 原來這裏是迴應:解析Java中
{"xml-fragment":{"workItem":{"@id":"251","@version":"74"},"presentation":{"@formIdenitifier":"1.0.0.201310151421/openspaceGWTPull_DefaultChannel/.default/Npda/NpdaProcess/UserReconcile/UserReconcile.gwt.json","@type":"GWT_FORM","@version":"1.0.0.201310151421","@activityName":"UserReconcile"},"workTypeDetail":{"@typePiled":"false","@pilingLimit":"0","@uid":"WT__RIoPEDWTEeOr4-yR8gXd7g","@version":"1.0.0.201310151421"},"payloadModel":{"serializedPayload":"{items:[{\"$param\":\"BankReconInput\",\"mode\":\"IN\",\"$value\":[{\"bankAccountTx_pk\":\"55213\",\"amount\":\"10099\",\"reference\":\"ImAmReference\",\"date\":\"2013-10-15\",\"reconType\":\"?\",\"amxcaseref\":\"pvm:0a12iq\",\"$type\":\"coza.npda.bom.BankTransaction\"}]}]}","@payloadMode":"JSON"}}}
我想例如從serializedPayload獲取量的值的問題是,它不是。JSON對象,如果我嘗試:
obj = new JSONObject(jsonResp).getJSONObject("xml-fragment").getJSONObject("payloadModel");
這個返回到我serializedPayload爲一個字符串,@payloadMode作爲字符串
我想:
obj = new JSONObject(jsonResp).getJSONObject("xml-fragment").getJSONObject("payloadModel").getJSONObject("serializedPayload");
它確認serializedPayload不是json對象。
我看了下這個例子:http://developer.android.com/reference/org/json/JSONTokener.html 但它的數據並不像我的那麼複雜,我正在努力尋找如何做到這一點的java示例。
請任何人都可以幫忙。