It is very easy to create native generic objects that can be serialized into JSON in dynamically typed languages like Python, PHP, or JS.
With Kotlin, it seems like I will need to define a serializable data class, at the very least, in order to be able to compose JSON for transmission. This is workable, but it breaks down pretty quickly when the data is complex or variable, and because of this is not very reusable.
Is there a good approach (using Kotlin) that allows for similar behavior to the dynamic approach?
I think ultimately, I'm looking for a generic object type, where I can assign properties, both flat and nested, which can then be serialized using the kotlinx serialization package - does anything like this exist with Kotlin?