Tech TLDR;

  • Archive
  • Top Posts
  • GitHub
  • LinkedIn
  • Contact

Parse JSON Object to Map in Scala Using Jackson

October 6, 2016 by admin

I couldn’t find a good example online, so here it goes.

import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.databind.ObjectMapper

val data = """
    {"some": "json data"}
"""

val mapper = new ObjectMapper

mapper.registerModule(DefaultScalaModule)
mapper.readValue(data, classOf[Map[String, String]])
Code language: PHP (php)

Hope it helps

Filed Under: Scala

Copyright © 2025 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in