public final class JsonUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
toJavaType(String json,
com.fasterxml.jackson.databind.JavaType javaType)
将Json转成Java对象
|
static String |
toJson(Object object)
将Java对象转成Json,约束规则JsonInclude.Include.NON_EMPTY
|
static String |
toJson(Object object,
com.fasterxml.jackson.annotation.JsonInclude.Include include)
将Java对象转成Json,默认约束规则JsonInclude.Include.NON_EMPTY
|
static <T> T |
toObject(String json,
Class<T> clazz)
将Json转成Java对象
|
static <T> T |
toTypeReference(String json,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
将Json转成Java对象
|
public static String toJson(Object object)
object - object 对象public static String toJson(Object object, com.fasterxml.jackson.annotation.JsonInclude.Include include)
object - object 对象include - JsonInclude.Includepublic static <T> T toObject(String json, Class<T> clazz)
T - 返回结果类型json - json 字符串clazz - Class对象public static <T> T toTypeReference(String json, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - TypeReference泛型中的泛型json - json 字符串typeReference - TypeReferencepublic static <T> T toJavaType(String json, com.fasterxml.jackson.databind.JavaType javaType)
T - JavaType的泛型json - json 字符串javaType - JavaTypeCopyright © 2022. All rights reserved.