Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
scalaVersion := "2.11.2"
libraryDependencies ++= Seq("com.propensive" %% "rapture-json-jackson" % "1.0.2")
import rapture.json._
import rapture.json.jsonBackends.jackson._
case class Fruit(name: String, variants: List[String])
object Rapture extends App {
val a = json"""[
"name": "apple",
"variants": ["cox", "braeburn"]
"name": "orange",
"variants": ["valencia", "hamlin"]
println(a(0)[List[String]] map (_.length))
val b =[List[Fruit]]
val c = Json(b.head)
assert(c == a(0))
Copy link

lrytz commented Oct 17, 2014

lucmac:rapture-json-demo luc$ sbt run
[info] Loading global plugins from /Users/luc/.sbt/0.13/plugins
[info] Set current project to rapture-json-demo (in build file:/Users/luc/tmp/rapture-json-demo/)
[info] Running Rapture 
List(3, 8)
List(Fruit(apple,List(cox, braeburn)), Fruit(orange,List(valencia, hamlin)))
[success] Total time: 1 s, completed Oct 17, 2014 4:14:41 PM


Copy link

propensive commented Oct 19, 2014

Use version 1.0.3 now -- I found a bug with case class extraction in 1.0.2 a couple of days ago!


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment