user10360768
user10360768

Reputation: 225

Convert jsonObject to Map in scala programming language

I am working in Scala programming language.

I want to convert json object to Map[String, String]

My jsonObject looks like

{"Key1":"Val1","Key2":"Val2","Key3":"Val3"}

I want to have a Map like

Map("Key1" -> "Val1", "Key2" -> "Val2", "Key3" -> "Val3")

How can i do this? Note: I am using Gson for my other json manipulation

Thanks

Upvotes: 0

Views: 1852

Answers (1)

Himanshu
Himanshu

Reputation: 164

You can use Jackson object Mapper for this.

https://www.alexkras.com/parse-json-object-to-map-in-scala-using-jackson/

Upvotes: 2

Related Questions