Package valorless.valorlessutils.json
Class JsonUtils
java.lang.Object
valorless.valorlessutils.json.JsonUtils
Utility class for working with JSON using Gson.
 Provides methods for serializing and deserializing objects,
 including pretty-printing and Bukkit-aware handling.
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> @Nullable TDeserializes a JSON string into an object using Bukkit-aware handling.static <T> TfromPlainJson(@Nullable String json) Deserializes a JSON string into a plain Java object.static StringConverts an object to a JSON string using the standard Gson instance.static StringtoPrettyJson(@Nullable Object object) Converts an object to a pretty-printed JSON string.
- 
Method Details- 
toJsonConverts an object to a JSON string using the standard Gson instance. The object may be a primitive, Map, List, null, or custom supported types.- Parameters:
- object- The object to serialize (nullable)
- Returns:
- JSON string representation
 
- 
toPrettyJsonConverts an object to a pretty-printed JSON string.- Parameters:
- object- The object to serialize (nullable)
- Returns:
- JSON string with pretty formatting
 
- 
fromPlainJsonDeserializes a JSON string into a plain Java object. Does not handle ConfigurationSerializable objects.- Type Parameters:
- T- The expected return type
- Parameters:
- json- JSON string to deserialize
- Returns:
- Deserialized object
- Throws:
- IllegalArgumentException- if deserialization fails
 
- 
fromJsonDeserializes a JSON string into an object using Bukkit-aware handling. Can deserialize ConfigurationSerializable objects.- Type Parameters:
- T- The expected return type
- Parameters:
- json- JSON string to deserialize
- Returns:
- Deserialized object or null if input is null
- Throws:
- IllegalArgumentException- if deserialization fails
 
 
-