diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MetaConverter.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MetaConverter.kt index 8959ae4a..00074525 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MetaConverter.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MetaConverter.kt @@ -135,16 +135,17 @@ public interface MetaConverter: MetaSpec { @DFExperimental public inline fun serializable( descriptor: MetaDescriptor? = null, + jsonEncoder: Json = Json { ignoreUnknownKeys = true }, ): MetaConverter = object : MetaConverter { private val serializer: KSerializer = serializer() override fun readOrNull(source: Meta): T? { val json = source.toJson(descriptor) - return Json.decodeFromJsonElement(serializer, json) + return jsonEncoder.decodeFromJsonElement(serializer, json) } override fun convert(obj: T): Meta { - val json = Json.encodeToJsonElement(obj) + val json = jsonEncoder.encodeToJsonElement(obj) return json.toMeta(descriptor) }