将Map集合转换成json格式的字符串

import org.codehaus.jackson.map.ObjectMapper;  //依赖


// 方法:
Map paramMap = new HashMap<>();
ObjectMapper json = new ObjectMapper();
String params = json.writeValueAsString(paramMap);


 

你可能感兴趣的:(java)