Is there common multiplatform way to represent a j...
# serialization
h
Is there common multiplatform way to represent a json? I don't need the full serialization stack, I'm just asking about the data-structure. Before I was using https://github.com/stleary/JSON-java for years, but I guess this one does not work in a multiplatform context. I have built my own builder with https://github.com/holgerbrandl/jsonbuilder, but I'd love to migrate it away from JSON-java
m
What about kotlinx.serialization? You can use the runtime without using the compiler plugin
h
So
org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1
? Does it support instantiating new json-objects by providing some constructor, or is it tied to the plugin?
m
I've been using it to do some generic parsing without the compiler.
h
Ah cool, thanks for the pointer. I'll give it a try.
m
On mobile right now but I think it's something like
Json.parseToJsonElement
Then you have a general purpose
JsonElement
b
Or you can just use simple
Map<String, Any>
h
kon looks great as well. I guess for my use-cases the more minimalistic approach compared to kotlinx-serialization might be more appropriate.