Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.52 KB | None | 0 0
  1. import kapiert.remote.RestBase
  2. import net.liftweb.json.JsonAST.{JField, JObject, JString, JValue}
  3.  
  4.  
  5.  
  6. implicit val formats = RestBase.formats
  7. val json:JValue = JObject(List(JField("nodeType",JString("Scope")), JField("name",JString("peter")), JField("jsonClass",JString("Test"))))
  8.  
  9. trait Testing{
  10.   val id:Option[String]
  11.   val name:String
  12.   val nodeType:String
  13. }
  14.  
  15. case class Test(name:String,nodeType:String,id:Option[String]) extends Testing
  16.  
  17.  
  18. val d = json.extract[Testing]
  19. d match {
  20.   case t:Test => t.nodeType
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement