mirror of
https://gitee.com/ssssssss-team/magic-api.git
synced 2026-06-09 10:23:53 +08:00
优化JSON序列化
This commit is contained in:
@@ -340,7 +340,7 @@ public class RequestHandler extends MagicController {
|
||||
debugContext.setCallback(variables -> {
|
||||
List<Map<String, Object>> varList = (List<Map<String, Object>>) variables.get("variables");
|
||||
varList.stream().filter(it -> it.containsKey("value")).forEach(variable -> {
|
||||
variable.put("value", JsonUtils.toJsonString(variable.get("value")));
|
||||
variable.put("value", JsonUtils.toJsonStringWithoutLog(variable.get("value")));
|
||||
});
|
||||
WebSocketSessionManager.sendBySessionId(sessionId, BREAKPOINT, variables);
|
||||
});
|
||||
|
||||
@@ -31,6 +31,14 @@ public class JsonUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static String toJsonStringWithoutLog(Object target) {
|
||||
try {
|
||||
return mapper.writeValueAsString(target);
|
||||
} catch (Exception e) {
|
||||
return target == null ? null : target.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T readValue(String json, TypeReference<T> typeReference) {
|
||||
try {
|
||||
return mapper.readValue(json, typeReference);
|
||||
|
||||
Reference in New Issue
Block a user