Moshi

class Moshi

Coordinates binding between JSON values and Java objects.

Moshi instances are thread-safe, meaning multiple threads can safely use a single instance concurrently.

Types

Builder
Link copied to clipboard
class Builder

Functions

adapter
Link copied to clipboard
open fun <T> adapter(type: Class<T>): JsonAdapter<T>
open fun <T> adapter(type: Type, annotationTypes: Array<Class<out Annotation>>): JsonAdapter<T>
open fun <T> adapter(type: Type, annotationType: Class<out Annotation>): JsonAdapter<T>
open fun <T> adapter(type: Type, annotations: Set<out Annotation>): JsonAdapter<T>
open fun <T> adapter(type: Type): JsonAdapter<T>
Returns a JSON adapter for {@code type}, creating it if necessary.
open fun <T> adapter(type: Type, annotations: Set<out Annotation>, @Nullable() fieldName: String): JsonAdapter<T>
An optional field name associated with this type.
newBuilder
Link copied to clipboard
open fun newBuilder(): Moshi.Builder
Returns a new builder containing all custom factories used by the current instance.
nextAdapter
Link copied to clipboard
open fun <T> nextAdapter(skipPast: JsonAdapter.Factory, type: Type, annotations: Set<out Annotation>): JsonAdapter<T>

Extensions

adapter
Link copied to clipboard
inline fun <T> Moshi.adapter(): JsonAdapter<T>
fun <T> Moshi.adapter(ktype: KType): JsonAdapter<T>