Package-level declarations

Types

Link copied to clipboard
open class ConfigurableMoshi(builder: Moshi.Builder, val defaultContentType: ContentType = APPLICATION_JSON, strictness: StrictnessMode = Lenient) : AutoMarshallingJson<MoshiNode>
Link copied to clipboard
object EventAdapter : JsonAdapter.Factory
Link copied to clipboard
abstract class IsAnInstanceOfAdapter<T : Any>(clazz: KClass<T>, resolveAdapter: Moshi.(KClass<T>) -> JsonAdapter<T> = { adapter(it.java) }) : JsonAdapter.Factory

This adapter factory will capture ALL instances of a particular superclass/interface.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

To implement custom JSON configuration, create your own object singleton. Extra mappings can be added before done() is called.

Link copied to clipboard
data class MoshiArray(val elements: List<MoshiNode>) : MoshiNode
Link copied to clipboard
data class MoshiBoolean(val value: Boolean) : MoshiNode
Link copied to clipboard
data class MoshiDecimal(val value: Double) : MoshiNode
Link copied to clipboard
data class MoshiInteger(val value: Long) : MoshiNode
Link copied to clipboard
sealed interface MoshiNode
Link copied to clipboard
object MoshiNodeAdapter : JsonAdapter.Factory
Link copied to clipboard
data object MoshiNull : MoshiNode
Link copied to clipboard
data class MoshiObject(val attributes: Map<String, MoshiNode>) : MoshiNode
Link copied to clipboard
data class MoshiString(val value: String) : MoshiNode
Link copied to clipboard
object ProhibitUnknownValuesAdapter : JsonAdapter.Factory
Link copied to clipboard
Link copied to clipboard
open class SimpleMoshiAdapterFactory(typesToAdapters: Pair<String, (Moshi) -> JsonAdapter<*>>) : JsonAdapter.Factory

Convenience class to create Moshi Adapter Factory

Link copied to clipboard

Determines if the marshaller should be lenient when parsing unknown fields

Link copied to clipboard

These adapters are the edge case adapters for dealing with Moshi

Link copied to clipboard

Functions

Link copied to clipboard
inline fun <T : JsonAdapter<K>, K> adapter(noinline fn: (Moshi) -> T): Pair<String, (Moshi) -> T>

Convenience function to create Moshi Adapter.

Link copied to clipboard
inline fun <T : JsonAdapter<K>, K> Moshi.Builder.addTyped(fn: T): Moshi.Builder

Convenience function to add a custom adapter.

Link copied to clipboard
fun Moshi.Builder.asConfigurable(kotlinFactory: JsonAdapter.Factory = KotlinJsonAdapterFactory()): AutoMappingConfiguration<Moshi.Builder>
Link copied to clipboard
inline fun <K> JsonAdapter<K>.asFactory(): SimpleMoshiAdapterFactory

Convenience function to create Moshi Adapter Factory for a simple Moshi Adapter

Link copied to clipboard
fun JsonWriter.boolean(name: String, theValue: Boolean?)
Link copied to clipboard
inline operator fun <T : Any, R : HttpMessage> ConfigurableMoshi.invoke(item: T): (R) -> R
inline operator fun <T : Any> ConfigurableMoshi.invoke(msg: HttpMessage): T
Link copied to clipboard
fun <T> JsonReader.list(item: () -> T): MutableList<T>?
fun <T> JsonReader.list(mk: () -> T, item: T.(String) -> Unit): MutableList<T?>?
fun JsonWriter.list(name: String, theValue: List<String>?)
fun <T> JsonWriter.list(list: List<T>?, fn: T.() -> Unit)
fun <T> JsonWriter.list(name: String, list: List<T>?, fn: T.() -> Unit)
Link copied to clipboard
fun <T> JsonReader.map(valueFn: () -> T): MutableMap<String, T>?
Link copied to clipboard
fun JsonWriter.number(name: String, theValue: Number?)
Link copied to clipboard
fun <T> JsonReader.obj(mk: () -> T, fn: T.(String) -> Unit): T
fun <T> JsonReader.obj(build: (Map<String, Any>) -> T, item: (String) -> Any): T
fun <T> JsonWriter.obj(obj: T?, fn: T.() -> Unit)
fun JsonWriter.obj(name: String, theValue: Map<String, Any?>?)
fun <T> JsonWriter.obj(name: String, obj: T?, fn: T.() -> Unit)
Link copied to clipboard
fun standardConfig(kotlinFactory: JsonAdapter.Factory = KotlinJsonAdapterFactory()): AutoMappingConfiguration<Moshi.Builder>
Link copied to clipboard
fun JsonWriter.string(name: String, theValue: String?)
Link copied to clipboard
fun JsonReader.stringList(): MutableList<String>?
Link copied to clipboard
fun JsonReader.stringMap(): Map<String, String>?
Link copied to clipboard
fun JsonReader.stringOrNull(): String?
Link copied to clipboard
Link copied to clipboard