NullSafeJsonAdapter

class NullSafeJsonAdapter<T> : JsonAdapter<T>

Constructors

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

Functions

delegate
Link copied to clipboard
open fun delegate(): JsonAdapter<T>
failOnUnknown
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.
fromJson
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.
fromJsonValue
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.
indent
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.
lenient
Link copied to clipboard
fun lenient(): JsonAdapter<T>
Returns a JSON adapter equal to this, but is lenient when reading and writing.
nonNull
Link copied to clipboard
fun nonNull(): JsonAdapter<T>
Returns a JSON adapter equal to this JSON adapter, but that refuses null values.
nullSafe
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.
serializeNulls
Link copied to clipboard
fun serializeNulls(): JsonAdapter<T>
Returns a JSON adapter equal to this JSON adapter, but that serializes nulls when encoding JSON.
toJson
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)
toJsonValue
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.
toString
Link copied to clipboard
open fun toString(): String