I am trying to decode a case class from JSON which contains fields that are defined as Option[Array[T]] and get decode failure when this field is missing. The decoder from circe is the default.
case class Quotation(BasicCover: Option[BasicCover],
Covers: Option[Array[Cover]],
ContractedCovers: Option[Array[Cover]],
BundleCovers: Option[Array[Bundle]],
Insured: Option[Person],
Customer: Option[Person])
case class Cover(Header: Option[String], SubHeader: Option[String], ProductCode: Option[Int], ProductDescr: Option[String], DeductibleAmount: Option[String], RoomType: Option[String],
CoverDescription: Option[String], CovCode: Option[Int])
Above are to example case classes that i am trying to decode from a JSON. Do i have to declare the Option[Array[Cover]] in a different way? Do i have to declare a specific decoder for all classes? Can i declare a decoder that handles only specific Type fields?