You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like Option[Seq[T]] isn't handled by Jsonx.formatCaseClass.
Here is code I used to reproduce it:
import ai.x.play.json.implicits.optionWithNull
case class Test(value: String, and: Option[Seq[Test]])
implicit val testFormats = Jsonx.formatCaseClass[Test]
Here is the full error message:
could not find implicit value for parameter helper: play.api.libs.json.Reads[Option[Seq[com.company.project.JsonFormats.Test]]]
TRIGGERED BY: could not find implicit value for parameter helper: ai.x.play.json.OptionValidationDispatcher[Option[Seq[com.company.project.JsonFormats.Test]]]
TO SOLVE THIS
1. Make sure there is a Reads[Option[Seq[com.company.project.JsonFormats.Test]]] or Format[Option[Seq[com.company.project.JsonFormats.Test]]] in the implicit scope
2. In case of Reads[Option[...]] you need to either
import ai.x.play.json.implicits.optionWithNull // suggested
or
import ai.x.play.json.implicits.optionNoError // buggy play-json 2.3 behavior
3. In case of Reads[... .type]
import ai.x.play.json.SingletonEncoder.simpleName
import ai.x.play.json.implicits.formatSingleton
implicit val testFormats = Jsonx.formatCaseClass[Test]
Is there some workaround to tell formatCaseClass how to handle this case?
The text was updated successfully, but these errors were encountered:
@caente Thanks, I see what you suggested for that one. This behavior works correctly using play json, the reason I am trying to use this lib instead is to support case classes larger than 22 fields.
It seems like Option[Seq[T]] isn't handled by Jsonx.formatCaseClass.
Here is code I used to reproduce it:
Here is the full error message:
Is there some workaround to tell formatCaseClass how to handle this case?
The text was updated successfully, but these errors were encountered: