public abstract class JsonUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private static JsonDateTypeAdapter |
DefaultJsonDateTypeAdapter
已过时。
|
private static com.google.gson.Gson |
gson
已过时。
|
static Charset |
JsonCharset |
static String |
JsonDateFormat |
| 构造器和说明 |
|---|
JsonUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
fromJson(InputStream reader,
Class<T> toClass) |
static <T> T |
fromJson(InputStream reader,
Type toClass) |
static <T> T |
fromJson(com.google.gson.JsonElement el,
Class<T> toClass) |
static <T> T |
fromJson(com.google.gson.JsonElement el,
Type type) |
static <T> T |
fromJson(String json,
Class<T> toClass)
从JSON中转换为对象
|
static <T> T |
fromJson(String json,
Type toClass) |
static com.google.gson.Gson |
getGson()
已过时。
|
static com.google.gson.Gson |
newGson()
新建一个GSON对象
|
static <T> String |
toJson(T object)
从对象转换为JSON
|
@Deprecated private static final JsonDateTypeAdapter DefaultJsonDateTypeAdapter
public static final Charset JsonCharset
@Deprecated private static com.google.gson.Gson gson
@Deprecated public static com.google.gson.Gson getGson()
public static com.google.gson.Gson newGson()
public static <T> String toJson(T object)
object - public static <T> T fromJson(String json, Class<T> toClass)
json - toClass - public static <T> T fromJson(InputStream reader, Class<T> toClass)
public static <T> T fromJson(InputStream reader, Type toClass)
public static <T> T fromJson(com.google.gson.JsonElement el,
Class<T> toClass)
public static <T> T fromJson(com.google.gson.JsonElement el,
Type type)
Copyright © 2022. All rights reserved.