Moritz Post
09/23/2021, 10:24 AMoverride val descriptor: SerialDescriptor = buildSerialDescriptor("Create", StructureKind.LIST) {
element("target", serialDescriptor<String>())
element("method", serialDescriptor<String>())
element("properties", serialDescriptor<Map<String, Any>>())
}
The remaining problem now is the Map<String, Any> part where i want to resolve the properties into a Map with properties and possible sublists. However there is not serializer for Any
. Any advice on how to serialize the Any correctly within the properties map?Emil Kantis
09/23/2021, 10:27 AMEmil Kantis
09/23/2021, 10:28 AM@Serializable data class Operation(val type: String, val active: Boolean, properties: JsonElement)
and skip doing custom serializerMoritz Post
09/23/2021, 10:28 AMMoritz Post
09/23/2021, 10:31 AMEmil Kantis
09/23/2021, 11:02 AMMoritz Post
09/24/2021, 3:05 PMJsonElement
as the Map value type is actually not performing the correct conversion. It treats primitive values as JsonPrimitive
, requiring to get the content
to retrieve the actual value. Is there a way to have the Any
be serialized and deserialized into kotlin types?Emil Kantis
09/24/2021, 3:19 PMMoritz Post
09/24/2021, 3:19 PM