Skip to content

Instantly share code, notes, and snippets.

@hissain
Created May 6, 2020 21:24
Show Gist options
  • Save hissain/04d9a37ad6e44c37c6e9bf9230208058 to your computer and use it in GitHub Desktop.
Save hissain/04d9a37ad6e44c37c6e9bf9230208058 to your computer and use it in GitHub Desktop.
val list = listOf(Student(), Student() ... )
val gson = Gson()
val jsonString = gson.toJson(list)
val sType = object : TypeToken<List<Student>>() { }.type
val otherList = gson.fromJson<List<Student>>(jsonString, sType)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment