Created
December 30, 2013 22:47
-
-
Save jackdempsey/8189527 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> Json.toJson((1, 2)) | |
<console>:20: error: No Json deserializer found for type (Int, Int). Try to implement an implicit Writes or Format for this type. | |
Json.toJson((1, 2)) | |
^ | |
scala> implicit val x = new Writes[(Int, Int)] { | |
| def writes(t: (Int, Int)): JsValue = { | |
| JsArray(Seq(JsNumber(t._1), JsNumber(t._2))) | |
| } | |
| } | |
x: play.api.libs.json.Writes[(Int, Int)] = $anon$1@62ea9973 | |
scala> Json.toJson((1, 2)) | |
res41: play.api.libs.json.JsValue = [1,2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment