Skip to content

Instantly share code, notes, and snippets.

@Pavneet-Sing
Last active May 6, 2020 18:20
Show Gist options
  • Save Pavneet-Sing/c14142876f619918cd957f04ab723e47 to your computer and use it in GitHub Desktop.
Save Pavneet-Sing/c14142876f619918cd957f04ab723e47 to your computer and use it in GitHub Desktop.
Parse a JSON response to Person data class
val dataJSONStr = """
{
"name": "Pavneet",
"occupation": "Software Engineer"
}
""".trimIndent()
val mapper = ObjectMapper()
println(mapper.readValue(dataJSONStr, Person::class.java))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment