How can I convert a json string to a scala map?
I tried the following method with json4s
3.2.11 and it works:
import org.json4s._import org.json4s.jackson.JsonMethods._//...def jsonStrToMap(jsonStr: String): Map[String, Any] = { implicit val formats = org.json4s.DefaultFormats parse(jsonStr).extract[Map[String, Any]]}
Maybe you didn't define the implicit val
of type Formats
? Note also that you don't need to have an implicit val
within every and each method as long as it's findable in the scope.