添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

How to deserialize a json file to Map[String,String] in scala? #64

Closed
@dineshbt

Description

It works fine for me in java where as in scala i am getting the below exception. Please let me know how can i resolve this?

val jsonContent ="""{"test":"113123","myList":{"test2":"321323"}}"""
val mapData = mapper.readValue(jsonContent, classOf[Map[String,String]])

Error:

com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of scala.collection.immutable.Map, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information
at [Source: java.io.StringReader@603b1d04; line: 1, column: 1]