public class JsonUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static com.google.gson.Gson |
gson |
| 构造器和说明 |
|---|
JsonUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
fromJson(com.google.gson.JsonElement json,
Type typeOfT) |
static <T> T |
fromJson(String obj,
Class<T> clazz) |
static <T> T |
fromJson(String str,
Type typeOfT) |
static <T> T |
fromJsonObject(com.google.gson.JsonElement jsonElement,
Class<T> clazz) |
static com.google.gson.JsonObject |
merge(com.google.gson.JsonObject dest,
com.google.gson.JsonObject src) |
static com.google.gson.JsonObject |
parametersToJsonObject(Map<String,Object> parameters) |
static com.google.gson.JsonObject |
parse(String jsonString) |
static com.google.gson.JsonElement |
parseReader(com.google.gson.stream.JsonReader reader)
Returns the next value from the JSON stream as a parse tree.
|
static com.google.gson.JsonElement |
parseReader(Reader reader)
Parses the specified JSON string into a parse tree
|
static com.google.gson.JsonElement |
parseString(String json)
Parses the specified JSON string into a parse tree
|
static String |
toJson(Object obj) |
static com.google.gson.JsonArray |
toJsonArray(Object obj) |
static com.google.gson.JsonElement |
toJsonElement(Object obj) |
static com.google.gson.JsonObject |
toJsonObject(Object obj) |
public static <T> T fromJson(com.google.gson.JsonElement json,
Type typeOfT)
public static <T> T fromJsonObject(com.google.gson.JsonElement jsonElement,
Class<T> clazz)
public static com.google.gson.JsonArray toJsonArray(Object obj)
public static com.google.gson.JsonObject toJsonObject(Object obj)
public static com.google.gson.JsonElement toJsonElement(Object obj)
public static com.google.gson.JsonObject parse(String jsonString)
public static com.google.gson.JsonElement parseString(String json) throws com.google.gson.JsonSyntaxException
json - JSON textJsonElements corresponding to the specified JSONcom.google.gson.JsonParseException - if the specified text is not valid JSONcom.google.gson.JsonSyntaxExceptionpublic static com.google.gson.JsonElement parseReader(Reader reader) throws com.google.gson.JsonIOException, com.google.gson.JsonSyntaxException
reader - JSON textJsonElements corresponding to the specified JSONcom.google.gson.JsonParseException - if the specified text is not valid JSONcom.google.gson.JsonIOExceptioncom.google.gson.JsonSyntaxExceptionpublic static com.google.gson.JsonElement parseReader(com.google.gson.stream.JsonReader reader)
throws com.google.gson.JsonIOException,
com.google.gson.JsonSyntaxException
reader - The json reader.com.google.gson.JsonParseException - if there is an IOException or if the specified text is not valid
JSONcom.google.gson.JsonIOExceptioncom.google.gson.JsonSyntaxExceptionpublic static com.google.gson.JsonObject merge(com.google.gson.JsonObject dest,
com.google.gson.JsonObject src)
Copyright © 2024. All rights reserved.