Skip to content

Instantly share code, notes, and snippets.

@hissain
Created May 6, 2020 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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