I'm trying to use the XML content negotiation, but...
# ktor
j
I'm trying to use the XML content negotiation, but it just fails without it making sense. I'm getting this error, and the firstname field does exist.
Copy code
Could not find a field for name Attendee/FirstName
  candidates: firstname, middleInitial, lastname, suffix, title, company, externalId, custom1, custom2, custom3, custom4, custom5, custom6, custom7, custom8, custom9, custom10, custom11, custom12, custom13, custom14, custom15, custom16, custom17, custom18, custom19, custom20, custom21, custom22, custom23, custom24, custom25 at position Line number = 3
I have tried renaming the
firstname
to
FirstName
, but it still won't find it and just give the same error.
Copy code
@Serializable
data class MyTest(val myTestNested: MyTestNested)
@Serializable
data class MyTestNested(val value: String? = "")

@Test
fun veryBasicTest() {
    val content = """
        <MyTest>
            <MyTestNested>
                <Value>Hello World</Value>
            </MyTestNested>
        </MyTest>
    """.trimIndent()
    val data = XML().decodeFromString(MyTest.serializer(), content)
    println(data)
}
Here's an very basic example showing the same issue.
a
Since this question is about the kotlinx.serialization framework I suggest asking it in the #serialization channel.
👍 1