public class JsonUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static com.fasterxml.jackson.databind.JsonNode |
readTree(String json)
读取 Json 字符串
|
static String |
toJsonString(Object object)
将对象转换为 Json
|
static <T> T |
toObject(String json,
Class<T> clazz)
将 Json 字符串转换为对象
|
public static String toJsonString(Object object) throws JsonParseException
object - 待转换的对象JsonParseException - 解析失败时抛出 JsonParseExceptionpublic static <T> T toObject(String json, Class<T> clazz) throws JsonParseException
T - 对象类型json - Json 字符串clazz - 对象类型JsonParseException - 解析失败时抛出 JsonParseExceptionpublic static com.fasterxml.jackson.databind.JsonNode readTree(String json)
json - Json 字符串Copyright © 2018. All rights reserved.