https://kotlinlang.org logo
#serialization
Title
# serialization
s

sandwwraith

09/21/2018, 2:38 PM
decodeElementIndex
indeed produces element index. You need to switch over it and then select proper property to decode
a

altavir

09/21/2018, 2:39 PM
Could you show a tiny example please? I've tried a lot of different things since there is no documentation so far, but did not manage to make it work.
I need to read char an trying to do it with
val key = decodeCharElement(descriptor, 0)
but it throws error
s

sandwwraith

09/21/2018, 2:41 PM
Hm, probably that part in keep should be covered more in details
a

altavir

09/21/2018, 2:41 PM
Oh, I forgot to look at keep. I tried to use project documentation.
s

sandwwraith

09/21/2018, 2:41 PM
There’s an old debug branch
sourcegen
that contains test data manually generated and committed to the repo. It has similar structure to what the plugin produces: https://github.com/Kotlin/kotlinx.serialization/blob/refactoring_sourcegen/integration-tests/test-data-sourcegen/src/SimpleData.kt#L61
a

altavir

09/21/2018, 2:49 PM
Thanks for example. But it seems it is impossible to use this solution in real life, it is too complicated.
13 Views