https://kotlinlang.org logo
n

nikhil kumar

03/29/2022, 11:02 AM
Hey, Has anyone tried to serialize Map<String, Any> ?
g

Grégory Lureau

03/29/2022, 11:39 AM
On which platforms? What's your problem?
n

nikhil kumar

03/29/2022, 11:47 AM
I am using kotlinx.serialization to serialize Map<String, Any>. But its showing Serializer has. not been found for type ‘Any’
g

Grégory Lureau

03/29/2022, 11:55 AM
You may want to check #serialization
Also your error message makes sense, I presume serializer cannot be determined magically, and using reflection may not be the best cross-platform approach (giving it's not available on all platforms afaik).
h

hfhbd

03/29/2022, 12:37 PM
Depending on your use case (internal/external serialization) and the number of classes I would prefer to use sealed classes.