直接将json 数据打印到页面,省去转换

Map m = new HashMap();
m.put("statusCode", 200);
m.put("message", "操作成功");
m.put("callbackType", "forward");
m.put("forwardUrl", href);
String json = JsonUtil.getJsonString4JavaMap(m);
getResponse().setCharacterEncoding("utf-8");
getResponse().setContentType("text/html; charset=UTF-8");
try {
getResponse().getWriter().write(json.toString());
} catch (IOException e) {

e.printStackTrace();
}

你可能感兴趣的:(json)