From 4021e24d6288ab11240e43daaf2fe10df00b6457 Mon Sep 17 00:00:00 2001 From: smallchill Date: Sat, 27 Jul 2024 17:10:28 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=20JsonUtil=E6=96=B0=E5=A2=9EreadListMap?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/tool/jackson/JsonUtil.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java index ebffab3..57180e8 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java @@ -803,6 +803,24 @@ public class JsonUtil { } } + /** + * 读取集合 + * + * @param content bytes + * @return 集合 + */ + public static List> readListMap(@Nullable String content) { + if (ObjectUtil.isEmpty(content)) { + return Collections.emptyList(); + } + try { + return getInstance().readValue(content, new TypeReference>>() { + }); + } catch (IOException e) { + throw Exceptions.unchecked(e); + } + } + /** * jackson 的类型转换 *