HashMap 轉 Json


<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);




	    
Map<String, Object> resultMap = new HashMap<>();
     resultMap.put("type", type);
    resultMap.put("id", 10);
    resultMap.put("name", "name");
     JSONArray jArray = new JSONArray();
    jArray.put(resultMap);
    String str = jArray.toString();

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM