Skip to content

Instantly share code, notes, and snippets.

@hissain
Created May 6, 2020 21:19
Show Gist options
  • Save hissain/e5f93ac70b39d83537f77cb09f032c71 to your computer and use it in GitHub Desktop.
Save hissain/e5f93ac70b39d83537f77cb09f032c71 to your computer and use it in GitHub Desktop.
data class Address(
var city: String? = null,
var post: String? = null) {
}
data class Student(
var name: String? = null,
var address: Address? = null) {
}
// Call
val student = Gson().fromJson<Student>(json, Student::class.java)
// student.address.city will be = "Rome"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment