I am trying to use json4s to parse json string into object but even after running this code i am getting following as print result.
JObject(List((numbers,JArray(List(JInt(1), JInt(2), JInt(3), JInt(4))))))
def main(args: Array[String]): Unit = {
val json = """{"users": [
{"name": "Foo", "emails": ["[email protected]", "[email protected]"]},
{"name": "Bar", "emails": ["[email protected]", "[email protected]"]}]
}"""
val obj = parse(json).extract[List[User]]
println(obj)
}
case class User(name: String, emails: List[String])
case class UserList(users: List[User]) {
override def toString(): String = {
this.users.foldLeft("")((a, b) => a + b.toString)
}
}
Please help