|
|
|
@@ -5,9 +5,11 @@ import com.fasterxml.jackson.databind.DeserializationFeature; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.fasterxml.jackson.databind.SerializationFeature; |
|
|
|
import com.fasterxml.jackson.databind.type.CollectionType; |
|
|
|
import com.ruoyi.common.core.utils.StringUtils; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@@ -140,6 +142,7 @@ public class JacksonUtil { |
|
|
|
*/ |
|
|
|
public static Map<String, Object> parseJSONStr2Map(String jsonStr) { |
|
|
|
try { |
|
|
|
if (StringUtils.isEmpty(jsonStr)) {return new HashMap<String, Object>();} |
|
|
|
// 对于json字符串新增的字段,由于返回的是map,不管 compatNewProps 设置成什么值都不会抛出异常 |
|
|
|
ObjectMapper objectMapper = getObjectMapper(null, false, false, true); |
|
|
|
return objectMapper.readValue(jsonStr, Map.class); |
|
|
|
@@ -158,6 +161,7 @@ public class JacksonUtil { |
|
|
|
*/ |
|
|
|
public static List<Map<String, Object>> parseJSONStr2MapList(String jsonStr) { |
|
|
|
try { |
|
|
|
if (StringUtils.isEmpty(jsonStr)) {return new ArrayList<>();} |
|
|
|
// 对于json字符串新增的字段,由于返回的是map,不管 compatNewProps 设置成什么值都不会抛出异常 |
|
|
|
ObjectMapper objectMapper = getObjectMapper(null, false, false, true); |
|
|
|
CollectionType listType = objectMapper.getTypeFactory().constructCollectionType(ArrayList.class, Map.class); |
|
|
|
|