Hey all, I'm working with a messy REST API that re...
# serialization
b
Hey all, I'm working with a messy REST API that requires JSON keys that change based upon table name. So a simple Json.stringify() isn't really going to work in this case. Is there a a low-level API in kotlinx.serialization.json that allows me to dynamically create JSON strings to send. (I would use a lib like klaxon, but I am using Kotlin MPP.) Any ideas?
s
I think you could use JsonElement, like JsonObject, they are Json primitive types and you could use it for dynamic JSON.
b
Yes, JsonObject and JsonArray are super useful for parsing JSON strings from the server for sure! But as far as I can see they cannot be used for actually creating new JSON. Like they have .get() methods, but do not have any .put() or .add() methods that I can find.