public class JsonUtil extends Object
| Constructor and Description |
|---|
JsonUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
convertValue(Object fromValue,
Class<T> toValueType)
对象类型转换
|
static <T> T |
convertValue(Object fromValue,
Type toValueType)
对象类型转换
|
static JsonAdapter |
getJsonAdapter()
获取 jsonAdapter
|
static JsonAdapter |
getJsonAdapter(JsonAdapter jsonAdapter)
获取 jsonAdapter
|
static <T> List<T> |
readList(byte[] json,
Class<T> clazz)
将 json byte array 转成对象集合
|
static <T> List<T> |
readList(String json,
Class<T> clazz)
将 json 字符串转成对象集合
|
static <T> T |
readValue(byte[] json,
Class<T> clazz)
将 json byte array 转成对象
|
static <T> T |
readValue(byte[] json,
Type type)
将 json byte array 转成对象
|
static <T> T |
readValue(String json,
Class<T> clazz)
将 json 字符串转成对象
|
static <T> T |
readValue(String json,
Type type)
将 json 字符串转成对象
|
static byte[] |
toJsonBytes(Object object)
转换成 json byte array
|
static String |
toJsonString(Object object)
转换成 json 字符串
|
public static JsonAdapter getJsonAdapter()
public static JsonAdapter getJsonAdapter(JsonAdapter jsonAdapter)
jsonAdapter - JsonAdapterpublic static String toJsonString(Object object)
object - objectpublic static byte[] toJsonBytes(Object object)
object - objectpublic static <T> T readValue(String json, Class<T> clazz)
T - 泛型json - jsonclazz - Classpublic static <T> T readValue(String json, Type type)
T - 泛型json - jsontype - Typepublic static <T> T readValue(byte[] json,
Class<T> clazz)
T - 泛型json - jsonclazz - Classpublic static <T> T readValue(byte[] json,
Type type)
T - 泛型json - jsontype - Typepublic static <T> List<T> readList(String json, Class<T> clazz)
T - 泛型json - jsonclazz - Classpublic static <T> List<T> readList(byte[] json, Class<T> clazz)
T - 泛型json - jsonclazz - Classpublic static <T> T convertValue(Object fromValue, Class<T> toValueType)
T - 泛型fromValue - fromValuetoValueType - toValueTypeCopyright © 2025. All rights reserved.