json数组字符串格式:
String nodes=[{"genre":"task","height":60,"alt":true,"width":150,"name":"项目研究决策","eId":"204"},{"genre":"task","height":60,"alt":true,"width":150,"name":"项目立项及方案研究","eId":"205"}]
java遍历代码
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
JSONArray jsonArray = JSONArray.fromObject(nodes);
for(int i=0;i<jsonArray.size();i++){
JSONObject jsob = jsonArray.getJSONObject(i);
System.out.println(jsob.get("eId"));
//这里可以把获取到的值给实体对象赋值
Node node = new node();
node.setEId(jsob.get("eId"));
}