MCPcopy Create free account
hub / github.com/diyhi/bbs / toJSONString

Method toJSONString

src/main/java/cms/component/JsonComponent.java:50–64  ·  view source on GitHub ↗

Java对象转Json字符串 本方法转换后字符串可以兼容各浏览器 @param object Java对象,可以是对象,数组,List,Map等 @return json 字符串

(Object object)

Source from the content-addressed store, hash-verified

48 * @return json 字符串
49 */
50 public String toJSONString(Object object) {
51 String jsonString = "";
52 try {
53
54 jsonString = objectMapper.writeValueAsString(object);
55
56 } catch (Exception e) {
57 //e.printStackTrace();
58 if (logger.isErrorEnabled()) {
59 logger.error("Java对象转Json字符串",e);
60 }
61 }
62 return jsonString;
63
64 }
65
66 /**
67 * Json字符串转Java对象

Callers 15

runMethod · 0.95
availableTagMethod · 0.80
replyAvailableTagMethod · 0.80
availableTagMethod · 0.80
manipulationDataMethod · 0.80
availableTagMethod · 0.80
replyAvailableTagMethod · 0.80
availableTagMethod · 0.80
addSectionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected