json字符串,轉換JSONObject

        //json字符串,轉換JSONObject
        JSONObject jsonobject = JSONObject.fromObject(jsonStr);
        //json對象轉成javaBean
        YourBean entity = (YourBean) JSONObject.toBean(jsonobject, YourBean.class);
        //json字符串,轉換JSONArray
        JSONArray info = JSONArray.fromObject(listStr);
        //JSONArray轉JavaBean集合
        List<YourBeanList> infoList = (List<YourBeanList>) JSONArray.toCollection(info, YourBeanList.class);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章