cbeust / klaxon

A JSON parser for Kotlin
Apache License 2.0
1.85k stars 122 forks source link

Optional property #362

Closed nicofari closed 1 year ago

nicofari commented 1 year ago

I have a data class with an optional property eg data Dto(val name: String, val hobby: String?)

This should accept: { "name": "Anne" } but deserializing a json like this raises an error. com.beust.klaxon.KlaxonException: Unable to instantiate Dto:No argument provided for a required parameter: parameter #0 hobby of fun `

How can I deal with this case?

thanks

nicofari commented 1 year ago

Ops never mind my mistake sorry!