public class JsonUtils
extends java.lang.Object
Constructor and Description |
---|
JsonUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
deserializeClass(JsonElement json,
java.lang.String memberName,
JsonDeserializationContext context,
java.lang.Class<? extends T> adapter) |
static <T> T |
deserializeClass(JsonObject json,
java.lang.String memberName,
JsonDeserializationContext context,
java.lang.Class<? extends T> adapter) |
static <T> T |
deserializeClass(JsonObject json,
java.lang.String memberName,
T fallback,
JsonDeserializationContext context,
java.lang.Class<? extends T> adapter) |
static <T> T |
fromJson(Gson p_193839_0_,
java.io.Reader p_193839_1_,
java.lang.Class<T> p_193839_2_) |
static <T> T |
fromJson(Gson p_193841_0_,
java.io.Reader p_193841_1_,
java.lang.reflect.Type p_193841_2_) |
static <T> T |
fromJson(Gson p_193838_0_,
java.io.Reader p_193838_1_,
java.lang.reflect.Type p_193838_2_,
boolean p_193838_3_) |
static <T> T |
fromJson(Gson p_193837_0_,
java.lang.String p_193837_1_,
java.lang.reflect.Type p_193837_2_,
boolean p_193837_3_) |
static boolean |
getBoolean(JsonElement json,
java.lang.String memberName)
Gets the boolean value of the given JsonElement.
|
static boolean |
getBoolean(JsonObject json,
java.lang.String memberName)
Gets the boolean value of the field on the JsonObject with the given name.
|
static boolean |
getBoolean(JsonObject json,
java.lang.String memberName,
boolean fallback)
Gets the boolean value of the field on the JsonObject with the given name, or the given default value if the
field is missing.
|
static float |
getFloat(JsonElement json,
java.lang.String memberName)
Gets the float value of the given JsonElement.
|
static float |
getFloat(JsonObject json,
java.lang.String memberName)
Gets the float value of the field on the JsonObject with the given name.
|
static float |
getFloat(JsonObject json,
java.lang.String memberName,
float fallback)
Gets the float value of the field on the JsonObject with the given name, or the given default value if the field
is missing.
|
static int |
getInt(JsonElement json,
java.lang.String memberName)
Gets the integer value of the given JsonElement.
|
static int |
getInt(JsonObject json,
java.lang.String memberName)
Gets the integer value of the field on the JsonObject with the given name.
|
static int |
getInt(JsonObject json,
java.lang.String memberName,
int fallback)
Gets the integer value of the field on the JsonObject with the given name, or the given default value if the
field is missing.
|
static Item |
getItem(JsonElement json,
java.lang.String memberName) |
static Item |
getItem(JsonObject json,
java.lang.String memberName) |
static JsonArray |
getJsonArray(JsonElement json,
java.lang.String memberName)
Gets the given JsonElement as a JsonArray.
|
static JsonArray |
getJsonArray(JsonObject json,
java.lang.String memberName)
Gets the JsonArray field on the JsonObject with the given name.
|
static JsonArray |
getJsonArray(JsonObject json,
java.lang.String memberName,
JsonArray fallback)
Gets the JsonArray field on the JsonObject with the given name, or the given default value if the field is
missing.
|
static JsonObject |
getJsonObject(JsonElement json,
java.lang.String memberName)
Gets the given JsonElement as a JsonObject.
|
static JsonObject |
getJsonObject(JsonObject json,
java.lang.String memberName) |
static JsonObject |
getJsonObject(JsonObject json,
java.lang.String memberName,
JsonObject fallback)
Gets the JsonObject field on the JsonObject with the given name, or the given default value if the field is
missing.
|
static java.lang.String |
getString(JsonElement json,
java.lang.String memberName)
Gets the string value of the given JsonElement.
|
static java.lang.String |
getString(JsonObject json,
java.lang.String memberName)
Gets the string value of the field on the JsonObject with the given name.
|
static java.lang.String |
getString(JsonObject json,
java.lang.String memberName,
java.lang.String fallback)
Gets the string value of the field on the JsonObject with the given name, or the given default value if the field
is missing.
|
static <T> T |
gsonDeserialize(Gson gsonIn,
java.io.Reader readerIn,
java.lang.Class<T> adapter,
boolean lenient) |
static <T> T |
gsonDeserialize(Gson gsonIn,
java.lang.String json,
java.lang.Class<T> adapter) |
static <T> T |
gsonDeserialize(Gson gsonIn,
java.lang.String json,
java.lang.Class<T> adapter,
boolean lenient) |
static <T> T |
gsonDeserialize(Gson p_193840_0_,
java.lang.String p_193840_1_,
java.lang.reflect.Type p_193840_2_) |
static boolean |
hasField(JsonObject json,
java.lang.String memberName)
Does the given JsonObject contain a field with the given name?
|
static boolean |
isBoolean(JsonObject json,
java.lang.String memberName) |
static boolean |
isJsonArray(JsonObject json,
java.lang.String memberName)
Does the given JsonObject contain an array field with the given name?
|
static boolean |
isJsonPrimitive(JsonObject json,
java.lang.String memberName)
Does the given JsonObject contain a field with the given name whose type is primitive (String, Java primitive, or
Java primitive wrapper)?
|
static boolean |
isNumber(JsonElement json) |
static boolean |
isString(JsonElement json)
Is the given JsonElement a string?
|
static boolean |
isString(JsonObject json,
java.lang.String memberName)
Does the given JsonObject contain a string field with the given name?
|
static java.lang.String |
toString(JsonElement json)
Gets a human-readable description of the given JsonElement's type.
|
public static boolean isString(JsonObject json, java.lang.String memberName)
public static boolean isString(JsonElement json)
public static boolean isNumber(JsonElement json)
public static boolean isBoolean(JsonObject json, java.lang.String memberName)
public static boolean isJsonArray(JsonObject json, java.lang.String memberName)
public static boolean isJsonPrimitive(JsonObject json, java.lang.String memberName)
public static boolean hasField(JsonObject json, java.lang.String memberName)
public static java.lang.String getString(JsonElement json, java.lang.String memberName)
public static java.lang.String getString(JsonObject json, java.lang.String memberName)
public static java.lang.String getString(JsonObject json, java.lang.String memberName, java.lang.String fallback)
public static Item getItem(JsonElement json, java.lang.String memberName)
public static Item getItem(JsonObject json, java.lang.String memberName)
public static boolean getBoolean(JsonElement json, java.lang.String memberName)
public static boolean getBoolean(JsonObject json, java.lang.String memberName)
public static boolean getBoolean(JsonObject json, java.lang.String memberName, boolean fallback)
public static float getFloat(JsonElement json, java.lang.String memberName)
public static float getFloat(JsonObject json, java.lang.String memberName)
public static float getFloat(JsonObject json, java.lang.String memberName, float fallback)
public static int getInt(JsonElement json, java.lang.String memberName)
public static int getInt(JsonObject json, java.lang.String memberName)
public static int getInt(JsonObject json, java.lang.String memberName, int fallback)
public static JsonObject getJsonObject(JsonElement json, java.lang.String memberName)
public static JsonObject getJsonObject(JsonObject json, java.lang.String memberName)
public static JsonObject getJsonObject(JsonObject json, java.lang.String memberName, JsonObject fallback)
public static JsonArray getJsonArray(JsonElement json, java.lang.String memberName)
public static JsonArray getJsonArray(JsonObject json, java.lang.String memberName)
public static JsonArray getJsonArray(JsonObject json, java.lang.String memberName, JsonArray fallback)
public static <T> T deserializeClass(JsonElement json, java.lang.String memberName, JsonDeserializationContext context, java.lang.Class<? extends T> adapter)
public static <T> T deserializeClass(JsonObject json, java.lang.String memberName, JsonDeserializationContext context, java.lang.Class<? extends T> adapter)
public static <T> T deserializeClass(JsonObject json, java.lang.String memberName, T fallback, JsonDeserializationContext context, java.lang.Class<? extends T> adapter)
public static java.lang.String toString(JsonElement json)
public static <T> T gsonDeserialize(Gson gsonIn, java.io.Reader readerIn, java.lang.Class<T> adapter, boolean lenient)
public static <T> T fromJson(Gson p_193838_0_, java.io.Reader p_193838_1_, java.lang.reflect.Type p_193838_2_, boolean p_193838_3_)
public static <T> T fromJson(Gson p_193837_0_, java.lang.String p_193837_1_, java.lang.reflect.Type p_193837_2_, boolean p_193837_3_)
public static <T> T gsonDeserialize(Gson gsonIn, java.lang.String json, java.lang.Class<T> adapter, boolean lenient)
public static <T> T fromJson(Gson p_193841_0_, java.io.Reader p_193841_1_, java.lang.reflect.Type p_193841_2_)
public static <T> T gsonDeserialize(Gson p_193840_0_, java.lang.String p_193840_1_, java.lang.reflect.Type p_193840_2_)
public static <T> T fromJson(Gson p_193839_0_, java.io.Reader p_193839_1_, java.lang.Class<T> p_193839_2_)
public static <T> T gsonDeserialize(Gson gsonIn, java.lang.String json, java.lang.Class<T> adapter)