Given a string of JSON, and a case class that corresponds to it, what\'s a simple way to parse the JSON into the case class? There are many libraries available, but it seem
I've used https://github.com/json4s/json4s , only gripe so far is https://github.com/json4s/json4s/issues/137
import org.json4s._
import org.json4s.native.JsonMethods._
implicit val formats = DefaultFormats
case class ParsedPage(crawlDate: String, domain:String, url:String, text: String)
val js = """ {
"crawlDate": "20150226",
"domain": "0x20.be",
"url": "http://0x20.be/smw/index.php?title=99_Bottles_of_Beer&oldid=6214",
"text": "99 Bottles of Beer From Whitespace (Hackerspace Gent) Revision as of 14:43, 8 August 2012 by Hans ( Talk | contribs ) 99 Bottles of Beer Where: Loading map... Just me, with 99 bottles of beer and some friends. Subpages"
}"""
parse(js).extract[ParsedPage]