Hi, I have a property which can be an integer or an object without any explicit `type` property. I tried to use JsonDeserialize annotation and provide a custom deserializer;
data class Report(val measures: List<IntOrMeasure>) @JsonDeserialize(using=IntOrMeasureDeserializer::class) sealed class IntOrMeasure { data class MeasureDefinition(val collection : DataMappingHttpService.RakamCollection, val name : String) : IntOrMeasure() data class MeasureId(val id : Int) : IntOrMeasure() } class IntOrMeasureDeserializer : JsonDeserializer<IntOrMeasure>() { override fun deserialize(p: JsonParser?, ctxt: DeserializationContext?): IntOrMeasure { return if(p!!.currentToken().isNumeric) { p.readValueAs(IntOrMeasure.MeasureId::class.java) } else { p.readValueAs(IntOrMeasure.MeasureDefinition::class.java) } } } p.readValueAs(IntOrMeasure.MeasureId::class.java) recursively calls deserialize again thus resulting with overflow. Any insights are appreciated, thanks. -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user+unsubscr...@googlegroups.com. To post to this group, send email to jackson-user@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/40e46f57-4527-4380-a649-231f00d0b216%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.