增加任意类型转换到Json静态函数

This commit is contained in:
2025-09-26 11:44:36 +08:00
parent 9de8b2c95c
commit 7d7810084e
@@ -26,4 +26,10 @@ public record ResponseData(
return JsonMapper.writeValueAsString(this); return JsonMapper.writeValueAsString(this);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException(e); } } throw new RuntimeException(e); } }
public static String AnyToJson(Object obj){
try {
return JsonMapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
throw new RuntimeException(e); } }
} }