js中傳遞json到後臺轉成對象,對象中有集合 /或者轉成集合

String escapeHtml=StringEscapeUtils.unescapeHtml(jsonStr);
System.out.println("escapeHtml=="+escapeHtml);
jsonStr=jsonStr.replace(""","\"");
Journal journal = com.alibaba.fastjson.JSON.parseObject(jsonStr, new com.alibaba.fastjson.TypeReference<Journal>(){});



JSONArray jsonarray = JSONArray.fromObject(jsonStr);
        List list2 = (List)JSONArray.toCollection(jsonarray, AccountItems.class);
        Iterator it = list2.iterator();
        Map<String,String> tempMap=new HashMap();
        while(it.hasNext()){
        AccountItems p = (AccountItems)it.next();


        list.add(p.getTell());
            System.out.println("tell:"+p.getTell());
            System.out.println("fuuName:"+p.getFuuName());
            tempMap.put(p.getTell(),p.getFuuName());
        }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章