im receiving an object from "real" js code which has all the properties like a data class i defined, but is not an instance of that class. is there an easy way to convert it into an object of my class in that case?
r
Robert Jaros
05/07/2019, 9:29 AM
Consider annotating your data class with
@Serializable
a
ankushg
05/07/2019, 2:41 PM
I've been dealing with this by adding extension functions on
Json
to map it into each of my data classes... but that's definitely not the optimal approach
t
thana
05/08/2019, 6:46 AM
@Robert Jaros thanks for yourinput - i tried this approach and found at least on bug in kotlinx.serialization (and filed) it. so whule didn;t work out (yet), at least i could help improving the library 😄
thana
05/08/2019, 6:46 AM
@ankushg not the best approach, yes, but i will do something like that, until the bug in the library is fixed. thank you, too 😄