Created
October 5, 2013 15:52
-
-
Save 89465127/6842565 to your computer and use it in GitHub Desktop.
Simple json deserialization in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.json | |
import net.liftweb.json._ | |
object HelloJson extends App { | |
case class Address(city: String, state: String) | |
case class Person(name: String, addresses: List[Address]) | |
implicit val formats = DefaultFormats | |
val json = parse(""" { "name" : "Billy", "addresses" : [{"city": "New York", "state": "NY"}, {"city": "Washington", "state": "DC"}] } """) | |
println(json.extract[Person]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jar at: http://search.maven.org/#search|ga|1|a%3A%22lift-json_2.9.2%22