Package com.squareup.moshi

Moshi is modern JSON library for Android and Java.

Types

Link copied to clipboard
annotation class FromJson
Link copied to clipboard
annotation class Json
Customizes how a field is encoded as JSON.
Link copied to clipboard
abstract class JsonAdapter<T>
Converts Java values to JSON, and JSON values to Java.
Link copied to clipboard
annotation class JsonClass
Customizes how a type is encoded as JSON.
Link copied to clipboard
class JsonDataException : RuntimeException
Thrown when the data in a JSON document doesn't match the data expected by the caller.
Link copied to clipboard
class JsonEncodingException : IOException
Thrown when the data being parsed is not encoded as valid JSON.
Link copied to clipboard
annotation class JsonQualifier
Annotates another annotation, causing it to specialize how values are encoded and decoded.
Link copied to clipboard
abstract class JsonReader : Closeable
Reads a JSON (RFC 7159) encoded value as a stream of tokens.
Link copied to clipboard
abstract class JsonWriter : Closeable, Flushable
Writes a JSON (RFC 7159) encoded value to a stream, one token at a time.
Link copied to clipboard
class Moshi
Coordinates binding between JSON values and Java objects.
Link copied to clipboard
annotation class ToJson
Link copied to clipboard
class Types
Factory methods for types.

Functions

Link copied to clipboard
inline fun <T> Moshi.adapter(): JsonAdapter<T>
fun <T> Moshi.adapter(ktype: KType): JsonAdapter<T>
Link copied to clipboard
inline fun <T> Moshi.Builder.addAdapter(adapter: JsonAdapter<T>): Moshi.Builder
Link copied to clipboard
fun Type.asArrayType(): GenericArrayType
fun KClass<*>.asArrayType(): GenericArrayType
fun KType.asArrayType(): GenericArrayType
Link copied to clipboard
inline fun <T : Annotation> Set<Annotation>.nextAnnotations(): Set<Annotation>?

Checks if this contains T. Returns the subset of this without T, or null if this does not contain T.

Link copied to clipboard
inline fun <T> subtypeOf(): WildcardType

Returns a type that represents an unknown type that extends T. For example, if T is CharSequence, this returns out CharSequence. If T is Any, this returns *, which is shorthand for out Any?.

Link copied to clipboard
inline fun <T> supertypeOf(): WildcardType

Returns a type that represents an unknown supertype of T bound. For example, if T is String, this returns in String.

Properties

Link copied to clipboard
val Type.rawType: Class<*>

Returns the raw Class type of this type.