25 lines
889 B
Kotlin
25 lines
889 B
Kotlin
package com.bitcointxoko.gudariwallet.api
|
|
|
|
import kotlinx.serialization.json.Json
|
|
|
|
/**
|
|
* Single source of truth for the app's Json instance.
|
|
*
|
|
* All serialization/deserialization — Retrofit, DataStore caches,
|
|
* and WebSocket message parsing — must use this instance so that
|
|
* configuration is applied consistently everywhere.
|
|
*
|
|
* Custom type serializers (e.g. [SuccessActionSerializer],
|
|
* [FlexibleStringSerializer]) are registered directly on the model
|
|
* classes via @Serializable(with = ...) so no explicit registration
|
|
* is needed here.
|
|
*/
|
|
object JsonProvider {
|
|
val json: Json = Json {
|
|
ignoreUnknownKeys = true // tolerate extra fields from the API
|
|
isLenient = true // accept unquoted/malformed JSON from some endpoints
|
|
explicitNulls = false // omit null fields when serializing requests
|
|
encodeDefaults = true
|
|
}
|
|
}
|