Here is a short example:
class FieldOnly extends Sup {
val a: String = ""
@JsonAlias(Array("bb", "bbb")) val b: Option[Int] = None
}
implicit val formats: Formats = DefaultFormats + FieldSerializer[Sup]()
import org.json4s.JsonDSL._
{
val jv = JObject(
JField("a", "bc"),
JField("bb", 3)
)
JsonMethods.pretty(jv)
val mm2 = Extraction.extract[FieldOnly](jv)
assert(mm2.a -> mm2.b == "bc" -> Some(3))
}
This triggered the error message:
org.scalatest.exceptions.TestFailedException: ("bc", None) did not equal ("bc", Some(3))
It appears that both aliases were ignored, is there an easy fix?