We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scala> import play.api.libs.json.Json._ import play.api.libs.json.Json._ scala> import play.api.libs.json._ import play.api.libs.json._ scala> final case class Android(name: String, version: String) defined class Android scala> final case class AiResponse[T](body: T) defined class AiResponse scala> implicit val androidFormat: Format[Android] = Json.format[Android] androidFormat: play.api.libs.json.Format[Android] = play.api.libs.json.OFormat$$anon$1@2cb66c68 scala> val androidAiResponseFormat = Json.format[AiResponse[Android]] androidAiResponseFormat: play.api.libs.json.OFormat[AiResponse[Android]] = play.api.libs.json.OFormat$$anon$1@704adf36
scala> Json.toJson(AiResponse(body = Android(name = "android", version = "1.0"))) res1: play.api.libs.json.JsValue = {"body":{"name":"android","version":"1.0"}}
scala> Json.fromJson[AiResponse[Android]](Json.parse("""{"body":{"name":"android","version":"1.0"}}""")) res3: play.api.libs.json.JsResult[AiResponse[Android]] = JsSuccess(AiResponse(Android(android,1.0)),)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Play Serialisers
Serialisation
Deserialisation
The text was updated successfully, but these errors were encountered: