How to serialize Scala Map to Json in PlayFramework? -


It seems that the game Jason Library is unable to serial Scala archive. Is there any alternative? I just need to dump the data out of the map.

  Import Slaal. Converter._import play.api.libs.ws.edu._ import scala.concurrent.executionContext.Implicits.global import drama. Libsson object is temporary {// true serializing wal javaMap = new java.util.HashMap [string, string] () javaMap.put ("abc", "def") // output: res1: string = {"abc": " Def "} Jason.Stringes (Jason. Tojson (Java Map)) / False Serialization Val ScaleMap = Map (" ABC "->" Def ") // & gt; ScalaMap: Scala.collection.immutable.Map [String, String] = Map (ABC -> Def) / Output: Ridge 2: string = {"blank": incorrect, "traceableAugain": true} Jason.Stringes (Jason ToJson (scalaMap)) // & gt; Res2: string = {"empty": incorrect, "traceable_again": true}}    

You are importing the wrong JSON library.

Import play.api.libs.json ._

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -