TIL: Circe JSON decoding for sealed trait hierarchies
import io.circe.generic.auto._ import io.circe.parser.decode sealed trait Thing1 case class SubThing1(a: Int) extends Thing1 decode[Thing1]("""{"SubThing1": {"a": 1}}""") // Returns Right(SubThing1(1)) decode[SubThing1]("""{"a": 1}""") // Returns Right(SubThing1(1))