🎉 JsonUtil新增readListMap方法

This commit is contained in:
smallchill 2024-07-27 17:10:28 +08:00
parent cc2d625d5d
commit 4021e24d62

View File

@ -803,6 +803,24 @@ public class JsonUtil {
} }
} }
/**
* 读取集合
*
* @param content bytes
* @return 集合
*/
public static List<Map<String, Object>> readListMap(@Nullable String content) {
if (ObjectUtil.isEmpty(content)) {
return Collections.emptyList();
}
try {
return getInstance().readValue(content, new TypeReference<List<Map<String, Object>>>() {
});
} catch (IOException e) {
throw Exceptions.unchecked(e);
}
}
/** /**
* jackson 的类型转换 * jackson 的类型转换
* *