seems like JSON does not support `writeStringEleme...
# serialization
n
seems like JSON does not support
writeStringElementValue
or similar, i hoped to be able to use the infrastructure to support writing customized JSON objects
s
what do you mean by ‘not support’?
if you want to write a custom serializer with code to similar what plugin generates, you can look for a hint here: https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/common/src/test/kotlin/kotlinx/serialization/CustomSerializersTest.kt#L51 It even has the feature you want – ignore default value
👍 1
n
i think i get it now, i did that without writeBegin and writeEnd
one more questions.. do indices indicate the positioning in the resulting json ?
s
theirs main purpose is to indicate position in Kotlin class definition, to be able to retrieve name for them. Resulting json will be formed in order you’ve made
writexxxElement
calls.
n
in the example you show that you can skip them with a if .. does that work always ? i have ~20 variables that i want to to skip serializin when they are their default value