Trying to parse a complex json object using Gson. Here are the data classes that are failing:
data class Advisor(
val students: List<Student>?,
)
sealed class Student {
data class BusinessMajor(val name: String, val items: List<Courses>) : Student()
data class ArtsMajor(val name: String, val items: List<Courses>) : Student()
}
At runtime, I get this exception:
java.lang.RuntimeException: Failed to invoke private com.mysite.myapp.ApiResponse$Student() with no args
I've read that this can be created by trying to parse abstract classes, but all the posts I've read are for Java. I don't see anything that helps with Kotlin data classes, particularly wrapped with a sealed
class.
Any help is appreciated. Thanks.