Advertisement
Guest User

json parsing

a guest
Apr 14th, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.59 KB | None | 0 0
  1. package models;
  2.  
  3. import play.api.libs.json._
  4. import play.api.libs.functional.syntax._
  5. import play.api.libs.json.Json
  6.  
  7. case class ScribbleModel(
  8.     _comment: String,
  9.     url: String,
  10.     frames: Seq[LineModel]
  11. )
  12.  
  13.  
  14. case class LineModel(
  15.    width: Int,
  16.    color: String,
  17.    points: Seq[Tuple2[Float,Float]]
  18. )
  19.  
  20. object ScribbleModel{
  21.     implicit val scribbleModelReads = Json.reads[ScribbleModel];
  22. }
  23.  
  24. object LineModel{
  25.    implicit def lineModelReads = Json.reads[LineModel];
  26.    //                            ^^^^^^^^^^^^^^^^^^^^^
  27.    // No implicit reads for Seq[(Float,Float)]
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement