public class JsonUtil extends Object
| 构造器和说明 |
|---|
JsonUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.springframework.http.converter.json.Jackson2ObjectMapperBuilder |
configBuilder(org.springframework.http.converter.json.Jackson2ObjectMapperBuilder builder)
对 Jackson2ObjectMapperBuilder 进行常用配置
|
static <T> T |
parseObject(String jsonString,
Class<T> type)
将 Json 字符串转为 Java 对象
|
static <T> String |
toJsonString(T object)
将 Java 对象转为 Json 字符串
|
public static <T> String toJsonString(T object)
T - 泛型object - Java 对象public static <T> T parseObject(String jsonString, Class<T> type)
T - 泛型jsonString - json 字符串type - 要转换的 java 类型public static org.springframework.http.converter.json.Jackson2ObjectMapperBuilder configBuilder(org.springframework.http.converter.json.Jackson2ObjectMapperBuilder builder)
builder - 当为 null 时, 将创建Copyright © 2021. All rights reserved.