Skip to content

Instantly share code, notes, and snippets.

@89465127
Created October 5, 2013 15:52
Show Gist options
  • Save 89465127/6842565 to your computer and use it in GitHub Desktop.
Save 89465127/6842565 to your computer and use it in GitHub Desktop.
Simple json deserialization in Scala
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])
}
@89465127
Copy link
Author

89465127 commented Oct 7, 2013

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