用maven引入fastjson jar包java
<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.24</version> </dependency>
Map map=new HashMap(); map.put("page_size","10"); map.put("page_index","1"); String param= JSON.toJSONString(map);
===========================================================web
Map<String, Object> resultMap = new HashMap<>(); resultMap.put("type", type); resultMap.put("id", 10); resultMap.put("name", "name"); JSONArray jArray = new JSONArray(); jArray.add(resultMap); String str = jArray.toString();