NullSafeJsonAdapter

class NullSafeJsonAdapter<T> : JsonAdapter<T>

Constructors

Link copied to clipboard
open fun NullSafeJsonAdapter(delegate: JsonAdapter<T>)

Functions

Link copied to clipboard
open fun delegate(): JsonAdapter<T>
Link copied to clipboard
fun failOnUnknown(): JsonAdapter<T>
Returns a JSON adapter equal to this, but that throws a JsonDataException when unknown names and values are encountered.
Link copied to clipboard
open fun fromJson(reader: JsonReader): T
Decodes a nullable instance of type T from the given reader.
fun fromJson(string: String): T
Decodes a nullable instance of type T from the given string.
fun fromJson(source: BufferedSource): T
Decodes a nullable instance of type T from the given source.
Link copied to clipboard
fun fromJsonValue(@Nullable value: Any): T
Decodes a Java value object from value, which must be comprised of maps, lists, strings, numbers, booleans and nulls.
Link copied to clipboard
open fun indent(indent: String): JsonAdapter<T>
Return a JSON adapter equal to this, but using indent to control how the result is formatted.
Link copied to clipboard
fun lenient(): JsonAdapter<T>
Returns a JSON adapter equal to this, but is lenient when reading and writing.
Link copied to clipboard
fun nonNull(): JsonAdapter<T>
Returns a JSON adapter equal to this JSON adapter, but that refuses null values.
Link copied to clipboard
fun nullSafe(): JsonAdapter<T>
Returns a JSON adapter equal to this JSON adapter, but with support for reading and writing nulls.
Link copied to clipboard
fun serializeNulls(): JsonAdapter<T>
Returns a JSON adapter equal to this JSON adapter, but that serializes nulls when encoding JSON.
Link copied to clipboard
fun toJson(@Nullable value: T): String
Encodes the given value into a String and returns it.
open fun toJson(writer: JsonWriter, @Nullable value: T)
Encodes the given value with the given writer.
fun toJson(sink: BufferedSink, @Nullable value: T)
Link copied to clipboard
fun toJsonValue(@Nullable value: T): Any
Encodes value as a Java value object comprised of maps, lists, strings, numbers, booleans, and nulls.
Link copied to clipboard
open fun toString(): String