Casey Brooks
09/06/2023, 3:08 PMCasey Brooks
09/06/2023, 3:09 PMstatmark56
09/07/2023, 10:07 AMdata class Book(
val id: String,
val title: String,
)
data class State(
val books: List<Book> = emptyList()
)
How should I define the JSON for this and how would you parse it?Casey Brooks
09/07/2023, 2:42 PM@Serializable
, as you can get it configured simply by passing the generated serializers to the ViewModel configuration. You can see the basic setup in the Web example ( state serialization, viewModel configuration).
I still need to update the docs page to show the full setup, but you can also use other serialization libraries as well. The API basically gives you the serialized String, and you can convert it to your State/Inputs however you needCasey Brooks
09/07/2023, 6:15 PM