From c97b0ade728ae9c02d3dd9e072db73526b407f88 Mon Sep 17 00:00:00 2001 From: fxbin Date: Sat, 23 Sep 2023 10:12:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=E6=96=B0=E5=A2=9EtoJso?= =?UTF-8?q?nByte=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/fxbin/bubble/core/util/JsonUtils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bubble-core/src/main/java/cn/fxbin/bubble/core/util/JsonUtils.java b/bubble-core/src/main/java/cn/fxbin/bubble/core/util/JsonUtils.java index 7548053d..64253776 100644 --- a/bubble-core/src/main/java/cn/fxbin/bubble/core/util/JsonUtils.java +++ b/bubble-core/src/main/java/cn/fxbin/bubble/core/util/JsonUtils.java @@ -40,6 +40,20 @@ public String toJson(Object object) { } } + /** + * json字节 + * + * @param value jsonBean + * @return {@link byte[]} + */ + public byte[] toJsonByte(Object value) { + try { + return JacksonHolder.INSTANCE.writeValueAsBytes(value); + } catch (JsonProcessingException e) { + throw new UtilException(e); + } + } + /** * isJsonString 是否为json格式字符串