circe / circe

Yet another JSON library for Scala

Home Page:https://circe.github.io/circe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bad encoding of Option in scala 2.12

gffuma opened this issue · comments

Encoding an Option of a case class with a field Option[Map] fails on scala 2.12

import io.circe._, io.circe.generic.auto._, io.circe.parser._, io.circe.syntax._
case class A(
  m: Option[Map[String, String]],
)
val x = Option(A(m=None))
println(x.asJson.noSpaces)

On scala 2.12:
{"m":[]}
On scala 2.13 is ok:
{ "m": null }

Did you ever get to the bottom of this? I'm experiencing exactly this behavior as well