mirror of
https://gitee.com/jzsw-it/yexuejc-base.git
synced 2025-06-08 06:44:04 +08:00
返回参数优化
This commit is contained in:
parent
763616c67d
commit
873bfcbe9f
@ -225,4 +225,20 @@ public class JsonUtil {
|
|||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化输出
|
||||||
|
*
|
||||||
|
* @param obj 需要输出对象
|
||||||
|
* @return 格式化后的字符串
|
||||||
|
*/
|
||||||
|
public static String formatPrinter(Object obj) {
|
||||||
|
String json = null;
|
||||||
|
try {
|
||||||
|
json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
log.warning("json to Object JsonProcessingException.\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user