http://mvnrepository.com/artifact/com.alibaba/fastjson/1.2.45

 

  JSONObject result = JSONObject.parseObject(json);
	Map map=new HashMap();
		map.put("total", total);
		map.put("rows", list);
		JSONObject result = JSONObject.parseObject(JSON.toJSONString(map)); 

 

 Stu stu=new Stu();
        stu.setAge(18);
        stu.setName("小王");
       List<Stu> listStu=new ArrayList<Stu>();
       Stu stu2=new Stu();
       stu2.setAge(18);
       stu2.setName("小王");
       listStu.add(stu2);
       stu.setStuList(listStu);
       JSONObject json1=JSONObject.parseObject(JSON.toJSONString(stu));
       List list = (List)json1.get("stuList");

 

JSONArray objects = JSONObject.parseArray("");

 

//ss转map,map转数组
        String ss="[{\"total\":1,\"size\":5}]";
        String dd=ss.replaceAll(",","},{");
        System.out.println(dd);
        List list = JSONObject.parseArray(dd);
        System.out.println(list.get(0));
        Map<String,Object> maps = (Map)JSON.parse(ss);  
        System.out.println(maps);

 

 

 

GitHub 加速计划 / js / json
41.72 K
6.61 K
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:1 个月前 )
960b763e 2 个月前
8c391e04 5 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐