convert string to object using Moshi
for some reason I want to transform this data class
@JsonClass(generateAdapter = true)
data class Planetary(
val localDate: LocalDate,
val title: String,
)
and I have created adapter for LocalDate
class DayAdapter {
@ToJson
fun toJson(date: LocalDate): String = date.toString()
/**
* Maps the [PlanetaryDto.date] json string to a [LocalDate]
*/
@FromJson
fun fromJson(date: String): LocalDate = LocalDate.parse(date)
}
and here is how I try to parcel Planetary to string
val...