bug fix
This commit is contained in:
parent
ab39d87329
commit
3b069128c6
@ -1,6 +1,7 @@
|
|||||||
package com.mindskip.xzs.utility;
|
package com.mindskip.xzs.utility;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.JavaType;
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -14,6 +15,10 @@ public class JsonUtil {
|
|||||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class);
|
private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class);
|
||||||
|
|
||||||
|
static {
|
||||||
|
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> String toJsonStr(T o) {
|
public static <T> String toJsonStr(T o) {
|
||||||
try {
|
try {
|
||||||
return MAPPER.writeValueAsString(o);
|
return MAPPER.writeValueAsString(o);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user