refactor: migrate to kotlinx serialization, eliminate gson dependency
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user