Join Slack
Powered by
is there a method that converts a data class to a ...
# announcements
c
christophsturm
02/21/2019, 11:09 AM
is there a method that converts a data class to a map? or iterates over all its fields?
k
karelpeeters
02/21/2019, 11:09 AM
You're going to need reflection for that.
c
christophsturm
02/21/2019, 11:11 AM
yes, i was just wondering if there is a method for that already
k
karelpeeters
02/21/2019, 11:12 AM
Looks like the Jackson object mapper can do it:
https://stackoverflow.com/a/50354581
c
christophsturm
02/21/2019, 11:12 AM
yes but that’s a huge dependency
h
hallvard
02/21/2019, 11:46 AM
Could be a nice extension to kotlinx.serialization, maybe?
2
Views
Open in Slack
Previous
Next