这种格式的json用struts2怎么转? struts2json 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 JSONObject jsonObject = JSONObject.fromObject(str);String total = jsonObject .getString("total ");JSONArray rowsArray = jsonObject.getJSONArray("rows");for (int i = 0; i <rowsArray .size(); i++) { JSONObject jsonRows = JSONObject.fromObject(rowsArray .get(i)); String productid = jsonRows.getString("productid"); ...... }JSONArray footerArray = jsonObject.getJSONArray("footer");for (int i = 0; i <footerArray .size(); i++) { JSONObject jsonFooter = JSONObject.fromObject(footerArray .get(i)); String unitcost = jsonRows.getString("unitcost"); ...... } 12行写错了 应该是String unitcost = jsonFooter.getString("unitcost"); 写上对应的java bean 用开源的jar 开源转 。json 转 bean 。bean 转json . 正则表达式。。或者eval("("+json字符串+")") JSONArray.fromObject这个是转化为jsonarray数组,你那明显是jsonobject,用JSONObject.fromObject才行 像easyui的东西,ajax请求过去返回这样的json对象,用eval()转化 求解一个filter问题 请问 extjs中的 radio 为啥不显示 大家看看吧 hibernate的一个问题,关于元素访问....!!~~一般的书都没给除详解 标签 如何过虑HTML标记 如何配置jboss支持shtml 工作流问题 帮我看看这段js代码,关于关闭浏览器的 jdbc-odbc桥驱动程序在JDK中自带的,还是需要另外安装? 数据库连接问题, 验证DES 我先请教一个报错的问题,我不清楚怎么了
JSONObject jsonObject = JSONObject.fromObject(str);
String total = jsonObject .getString("total ");
JSONArray rowsArray = jsonObject.getJSONArray("rows");
for (int i = 0; i <rowsArray .size(); i++) {
JSONObject jsonRows = JSONObject.fromObject(rowsArray .get(i));
String productid = jsonRows.getString("productid");
......
}
JSONArray footerArray = jsonObject.getJSONArray("footer");
for (int i = 0; i <footerArray .size(); i++) {
JSONObject jsonFooter = JSONObject.fromObject(footerArray .get(i));
String unitcost = jsonRows.getString("unitcost");
......
}
bean 转json .
或者eval("("+json字符串+")")