Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package models.helper
  2. import play.api.libs.json.Format
  3. import play.api.libs.json.JsValue
  4. import play.api.libs.json.JsObject
  5. import play.api.libs.json.JsString
  6.  
  7. case class Search (name: String, `type`:String){
  8.  
  9. implicit object SearchFormat extends Format[Search] {
  10. def reads(json: JsValue): Search = Search(
  11. (json "name").as[String],
  12. (json "type").as[String]
  13. )
  14.  
  15. def writes(s: Search): JsValue = JsObject(Seq(
  16. "name" -> JsString(s.name),
  17. "type" -> JsString(s.`type`)
  18. ))
  19. }
  20. }
  21.  
  22. val search = response.json.as[Search]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement