fromJson

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

Deserializes a JSON string into the specified class

Return

Deserialized JSON

Parameters

json

The JSON string to deserialize

clazz

The class to deserialize the JSON into


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

Deserializes a JSON string into the specified class

Return

Deserialized JSON

Parameters

reader

The reader from which JSON will be deserialized

clazz

The class to deserialize the JSON into


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

Deserializes a JSON string into the specified object

Return

Deserialized JSON

Parameters

json

The JSON string to deserialize

type

The type of the object to deserialize the JSON into


fun <T> fromJson(json: String?, clazz: Class<T>): T

Deprecated

Use kt extension for Gson

Replace with

gson.fromJson(json, clazz)

fun <T> fromJson(reader: Reader?, clazz: Class<T>): T

Deprecated

Use kt extension for Gson

Replace with

gson.fromJson(reader, clazz)

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

Deprecated

Use kt extension for Gson

Replace with

gson.fromJson(json, type)