I’m trying to learn the recommended way to do data migration with kotlinx serialization.
Let’s say for example I have data that was previously saved as JSON using:
@Serializable
data class Foo(
val a: String,
val b: Int,
val c: Float,
val d: String
)
And I want to read old data and migrate it to a new format:
@Serializable
data class Foo(
val bar: Bar,
val d: String
)
@Serializable
data class Bar(
val a: String,
val b: Int,
val c: Float
)
What’s the best way to go about this?