解决方案 »

  1.   


    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");
         ......
     }
      

  2.   

    12行写错了 应该是String unitcost = jsonFooter.getString("unitcost");
      

  3.   

    写上对应的java bean 用开源的jar 开源转 。json 转 bean 。
    bean 转json .
      

  4.   

    正则表达式。。
    或者eval("("+json字符串+")")
      

  5.   

    JSONArray.fromObject这个是转化为jsonarray数组,你那明显是jsonobject,用JSONObject.fromObject才行
      

  6.   

    像easyui的东西,ajax请求过去返回这样的json对象,用eval()转化