pniederw
06/06/2021, 3:48 PMMap<String, (Number|Boolean|String)?>
, ideally in a serialization format agnostic way? I guess what I'm asking for is Decoder.peekType()
. I've looked at JsonDecoder.decodeJsonElement()
but the implementation is all internal
.ephemient
06/06/2021, 3:53 PMMap<String, JsonPrimitive>
or something as a surrogate maybe? https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#composite-serializer-via-surrogateNikky
06/06/2021, 3:59 PMpniederw
06/06/2021, 4:01 PMephemient
06/06/2021, 4:02 PMpniederw
06/06/2021, 4:03 PMpniederw
06/06/2021, 4:05 PMMap<String, (Number|Boolean|String|List|Map)?>
without any input conversion steps.ephemient
06/06/2021, 4:06 PMpniederw
06/06/2021, 4:06 PMDecoder.peekType()
, a generalization of what JsonDecoder.decodeJsonElement
already does.ephemient
06/06/2021, 4:07 PMpniederw
06/06/2021, 4:07 PMpniederw
06/06/2021, 4:07 PMephemient
06/06/2021, 4:08 PMpniederw
06/06/2021, 4:08 PMpniederw
06/06/2021, 4:11 PMephemient
06/06/2021, 4:11 PMephemient
06/06/2021, 4:12 PMpniederw
06/06/2021, 4:16 PMJsonDecoder
returns JsonElement
, which requires me to recursively convert back to Map<String, (Number|Boolean|String|List|Map)?>
, which is my current workaround.pniederw
06/06/2021, 4:24 PMNikky
06/06/2021, 5:14 PMSerializer
so you can construct it the same way as MapSerializer(keySerializer, valueSerializer)
or ListSerializer(valueSerializer)
Nikky
06/06/2021, 5:14 PMpniederw
06/06/2021, 5:36 PMpniederw
06/06/2021, 5:39 PMMap<String, Any>
. If necessary, I can tag values in the serialized format, but it's not clear to me how to make this work without using wrapper types similar to JsonElement
on the Kotlin side (which I absolutely don't want), and it shouldn't be necessary as long as I'm using JSON/CBOR.ephemient
06/06/2021, 5:54 PMpniederw
06/06/2021, 6:11 PMKSerializer<Map<String, Any>>
(last time I tried I got some compiler plugin error).