GsonUtils

object GsonUtils

Properties

Link copied to clipboard
val gson: Gson

Gson instance

Link copied to clipboard

Gson instance with pretty print enabled

Link copied to clipboard

Gson instance with same config as Discord uses for com.discord.utilities.rest.RestAPI

Functions

Link copied to clipboard
fun <T> fromJson(reader: Reader?, clazz: Class<T>): T
fun <T> fromJson(json: String?, clazz: Class<T>): T
fun <T> fromJson(json: String?, type: Type?): T

fun <T> Gson.fromJson(reader: Reader?, clazz: Class<T>): T
fun <T> Gson.fromJson(json: String?, clazz: Class<T>): T

Deserializes a JSON string into the specified class

fun <T> Gson.fromJson(json: String?, type: Type?): T

Deserializes a JSON string into the specified object

Link copied to clipboard

fun Gson.toJson(obj: Any?): String

Serializes an Object to JSON

Link copied to clipboard

Serializes an Object to pretty printed JSON