How to convert Scala Map into JSON String?

前端 未结 7 1787
一向
一向 2021-02-07 04:19

For example, I have this Map value in Scala:

val m = Map(
    \"name\" -> \"john doe\", 
    \"age\" -> 18, 
    \"hasChild\" -> true, 
    \"childs\" -         


        
7条回答
  •  执念已碎
    2021-02-07 04:46

    You need to tell jackson how to deal with scala objects: mapper.registerModule(DefaultScalaModule)

提交回复
热议问题