mirror of
https://github.com/TheWhiteDog9487/WebAPI.git
synced 2026-08-11 23:01:30 +08:00
增加任意类型转换到Json静态函数
This commit is contained in:
@@ -26,4 +26,10 @@ public record ResponseData(
|
||||
return JsonMapper.writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e); } }
|
||||
|
||||
public static String AnyToJson(Object obj){
|
||||
try {
|
||||
return JsonMapper.writeValueAsString(obj);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e); } }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user