Data class with default param is not serialized
sapuglha opened this issue · 2 comments
sapuglha commented
Serialization of data classes where properties contain default params are not being serialized, since the recent upgrade to 1.0.0 (from 1.0.0-RC) and this lib from 0.7.0 to 0.8.0.
I added a new test to replicate the problem. #37
I'm not sure whether a change in this lib or Kotlin Serialization is the reason for that.
sandwwraith commented
This is caused by the fact that in 1.0.0 the default behavior was changed, see changelog. Now kotlinx.serialization's Json does not serialize default values by default. To change that, you can add encodeDefaults = true
to your Json {}
configuration block.
sapuglha commented
Thanks @sandwwraith, I should have checked the changelog first.