I wanted to switch from Jackson to kotlinx serialization. But in my project I use two aspects heavily:
@JsonRawValue
for a string that already IS a valid Json string that needs to be put into the encoded result without any intervention, no escaping, nothing - and secondly I always work on unknown structures using
Map<String, Any?>
as my data values. How can kotlinx-serialization do these two things?
👍 1
t
Tomas Kormanak
10/14/2020, 3:02 PM
I am also interested if anyone have a working solution for deserialization unknown structures into map.
👍 2
a
araqnid
10/14/2020, 4:44 PM
You can deserialize into JsonElement, which represents objects as Map<String,JsonElement>
o
Olaf Gottschalk
10/15/2020, 5:43 AM
Thanks, that's something. But sadly I am coming more from the serialization side and having my incoming data as JsonElement would make it tightly coupled to the kotlinx serialization library, which I wanted to avoid...