map转json pojo转map
程序员文章站
2024-02-15 19:31:16
...
=============json==============
后台
Map<String,String> htmlMap = new HashMap<String,String>();
org.json.JSONObject json = new org.json.JSONObject.JSONObject(htmlMap);
response.setContentType("text/plain;charset=UTF-8");
response.setDateHeader("Expires", 0);
response.addHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write(json.toString());
前台
result = eval('(' + result + ')');
var itemHtml = result.itemHtml;
// POJO转成map
Map<String, String> paramMap = org.apache.commons.beanutils.PropertyUtils.describe(dto);
JSONObject json = new JSONObject(paramMap);
json.remove("class");
上一篇: 记录vscode内网无法建立ssh连接