json5k
json5k copied to clipboard
Ignore unkown keys
Is there a way to ignore unknown keys in json5k (kotlinx equivalent of Json { ignoreUnknownKeys = true }?
At the time being, I am afraid this is not possible.
As part of #2, I plan to add a more flexible interface between the parser and the kotlinx.serialization integration. When this is available, implementing an ignoreUnknownKeys option will be straightforward.
Maybe this should work?
val json = Json5.decodeFromString<JsonElement>(text)
val obj = Json { ignoreUnknownKeys = true }.decodeFromJsonElement<Obj>(json)