-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Like kotlinx.serialization.json, it would be helpful to include the content when decoding, ideally the attribute/element (including its namespace) that failed.
Given class:
@Serializable
data class A(val a: String, val c: Int)
Using json Json.decodeFromString(A.serializer(), """{"a": "b", "d": 42}""")
:
kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 13: Encountered an unknown key 'd' at path: $.a
Use 'ignoreUnknownKeys = true' in 'Json {}' builder to ignore unknown keys.
JSON input: {"a": "b", "d": 42}
Using xml XML.decodeFromString(A.serializer(), """<A a="asd" d="asfd"/>""")
:
nl.adaptivity.xmlutil.serialization.UnknownXmlFieldException: Could not find a field for name (ATest.A) A/d (Attribute)
candidates: a (Attribute), c (Attribute) at position Line number = 1
Column number = 22
System Id = null
Public Id = null
Location Uri= null
CharacterOffset = 21
sschuberth
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request