Olaf Gottschalk
02/03/2025, 1:38 PM@Serializable
data class Foo(
val bar: String
)
which has many json files created and stored on disk.
The all look like this:
{
"bar": "value"
}
Now I need to rename the field, also affecting the newly serialized output. BUT: I still need to be able to read (deserizlize) the old files without touching them.
So:
@Serializable
data class Foo(
val baz: String
)
is the new format.. where baz actually is just the new name for bar...
I tried @SerialName(...)
but that does not work, it does not act as an alias, it just changes the serial name for both read & write...
Any hints how this is supposed to be done?
Thanks!Emil Kantis
02/03/2025, 1:48 PM