Package net.minecraft.util
Class JsonHelper
java.lang.Object
net.minecraft.util.JsonHelper
public class JsonHelper extends Object
-
Field Summary
-
Constructor Summary
Constructors Constructor Description JsonHelper()
-
Method Summary
Modifier and Type Method Description static JsonArray
asArray(JsonElement element, String name)
static boolean
asBoolean(JsonElement element, String name)
static byte
asByte(JsonElement element, String name)
static float
asFloat(JsonElement element, String name)
static int
asInt(JsonElement element, String name)
static Item
asItem(JsonElement element, String name)
static long
asLong(JsonElement element, String name)
static JsonObject
asObject(JsonElement element, String name)
static String
asString(JsonElement element, String name)
static <T> T
deserialize(Gson gson, Reader reader, TypeToken<T> typeToken)
static <T> T
deserialize(Gson gson, Reader reader, TypeToken<T> typeToken, boolean lenient)
static <T> T
deserialize(Gson gson, Reader reader, Class<T> class2)
static <T> T
deserialize(Gson gson, Reader reader, Class<T> type, boolean lenient)
static <T> T
deserialize(Gson gson, String content, TypeToken<T> typeToken)
static <T> T
deserialize(Gson gson, String content, TypeToken<T> typeToken, boolean lenient)
static <T> T
deserialize(Gson gson, String content, Class<T> class2)
static <T> T
deserialize(Gson gson, String content, Class<T> class2, boolean lenient)
static <T> T
deserialize(JsonElement element, String name, JsonDeserializationContext context, Class<? extends T> type)
static <T> T
deserialize(JsonObject object, String element, JsonDeserializationContext context, Class<? extends T> type)
static <T> T
deserialize(JsonObject object, String element, T defaultValue, JsonDeserializationContext context, Class<? extends T> type)
static JsonObject
deserialize(Reader reader)
static JsonObject
deserialize(Reader reader, boolean lenient)
static JsonObject
deserialize(String content)
static JsonObject
deserialize(String content, boolean lenient)
static JsonArray
getArray(JsonObject object, String element)
static JsonArray
getArray(JsonObject object, String name, JsonArray defaultArray)
static boolean
getBoolean(JsonObject object, String element)
static boolean
getBoolean(JsonObject object, String element, boolean defaultBoolean)
static byte
getByte(JsonObject object, String element, byte defaultByte)
static float
getFloat(JsonObject object, String element)
static float
getFloat(JsonObject object, String element, float defaultFloat)
static int
getInt(JsonObject object, String element)
static int
getInt(JsonObject object, String element, int defaultInt)
static Item
getItem(JsonObject object, String key)
static long
getLong(JsonObject object, String name)
static long
getLong(JsonObject object, String element, long defaultLong)
static JsonObject
getObject(JsonObject object, String element)
static JsonObject
getObject(JsonObject object, String element, JsonObject defaultObject)
static String
getString(JsonObject object, String element)
static String
getString(JsonObject object, String element, String defaultStr)
static String
getType(JsonElement element)
static boolean
hasArray(JsonObject object, String element)
static boolean
hasBoolean(JsonObject object, String element)
static boolean
hasElement(JsonObject object, String lement)
static boolean
hasPrimitive(JsonObject object, String element)
static boolean
hasString(JsonObject object, String element)
static boolean
isNumber(JsonElement element)
static boolean
isString(JsonElement element)
-
Field Details
-
GSON
-
-
Constructor Details
-
JsonHelper
public JsonHelper()
-
-
Method Details
-
hasString
-
isString
-
isNumber
-
hasBoolean
-
hasArray
-
hasPrimitive
-
hasElement
-
asString
-
getString
-
getString
-
asItem
-
getItem
-
asBoolean
-
getBoolean
-
getBoolean
-
asFloat
-
getFloat
-
getFloat
-
asLong
-
getLong
-
getLong
-
asInt
-
getInt
-
getInt
-
asByte
-
getByte
-
asObject
-
getObject
-
getObject
-
asArray
-
getArray
-
getArray
-
deserialize
public static <T> T deserialize(@Nullable JsonElement element, String name, JsonDeserializationContext context, Class<? extends T> type) -
deserialize
public static <T> T deserialize(JsonObject object, String element, JsonDeserializationContext context, Class<? extends T> type) -
deserialize
public static <T> T deserialize(JsonObject object, String element, T defaultValue, JsonDeserializationContext context, Class<? extends T> type) -
getType
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-
deserialize
-