ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Follow publication

Parsing with Jackson and Kotlin

Pavneet Singh
ProAndroidDev
Published in
2 min readMay 7, 2020

Need of Default Constructor

data class Person(var name: String, var occupation: String)
Exception in thread "main" com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `Person` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (String)"{
"name": "Pavneet",
"occupation": "Software Engineer"
}"

Jackson Kotlin Module

val mapper = ObjectMapper().registerModule(KotlinModule())

Handling Missing Values

{
"name": "Pavneet",
}

Published in ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Written by Pavneet Singh

Software engineer, Author, Ex-SME. SO contributor. Puns and tweets.

No responses yet

Write a response