case class ClassA(a:String, b:String …) // >22 case classes
object ClassA {
implicit val classAJsonFormat = Jsonx.formatCaseClassUseDefaults[ClassA]
}
case class ClassB(classAlist: List[ClassA] = List(), a:String, b: String …) // >22 case classes
object ClassB {
implicit val classBJsonFormat = Jsonx.formatCaseClassUseDefaults[ClassB]
}
I get compilation error with the message:
could not find implicit value for parameter helper: play.api.libs.json.Reads[List[A]]
TRIGGERED BY: could not find implicit value for parameter helper: ai.x.play.json.OptionValidationDispatcher[List[A]]
TO SOLVE THIS
1. Make sure there is a Reads[List[A]] or Format[List[A]] 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 lazy val jsonFormat = Jsonx.formatCaseClassUseDefaults[B]
I have read the related issues (ex. #58) and tried to use formatSealedCompositeClassJsonFormat etc., but nothing seems to work. T^T
This is my code:
I get compilation error with the message:
I have read the related issues (ex. #58) and tried to use
formatSealed
CompositeClassJsonFormat
etc., but nothing seems to work. T^Tscala 2.12.10, play-json 2.8.1, play-json-extensions 0.10.0