Joe Joe - 1 year ago 88
Scala Question

cant extract simple json to case class with json4s

im trying to use json4s in a worksheet to try it out, I want simply to extract a json to some case class:

import org.json4s.native.JsonMethods
import org.json4s.{DefaultFormats, Extraction, JValue}

case class Person(name: String, age: Int)
val json = """{"name":"joe","age":15}"""


Answer Source

You forgot the implicit val jsonDefaultFormats = DefaultFormats right after your imports.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download