Skip to content

Instantly share code, notes, and snippets.

@ryanlecompte
Created July 9, 2013 20:50
Show Gist options
  • Save ryanlecompte/5961158 to your computer and use it in GitHub Desktop.
Save ryanlecompte/5961158 to your computer and use it in GitHub Desktop.
scala> import net.liftweb.json._
import net.liftweb.json._
scala> import net.liftweb.json.JsonDSL._
import net.liftweb.json.JsonDSL._
scala> implicit val formats = DefaultFormats
formats: net.liftweb.json.DefaultFormats.type = net.liftweb.json.DefaultFormats$@158faa04
scala> val json = """[1,2,3,4,5]"""
json: java.lang.String = [1,2,3,4,5]
scala> parse(json).extract[List[Int]]
res1: List[Int] = List(1, 2, 3, 4, 5)
scala> parse(json).extract[Set[Int]]
res2: Set[Int] = Set(5, 1, 2, 3, 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment