I am working on Play Framework 2.0 and it uses Jerkson to parse JSON strings. I was using it successfully to parse Immutable Lists of strings like so:
Json.parse( jsonStr ).as[ List[String] ]
But this code doesn’t work for me when I try
Json.parse( jsonStr ).as[ MutableList[String] ]
Does anyone know how I can do this easily?
E.g.
new MutableList[String]() ++= Json.parse( jsonStr ).as[ List[String] ](assuming @DanSimon is correct about whichMutableListyou mean). But the most used mutable list-like collection in Scala is aBufferwhich could be obtained asBuffer(Json.parse( jsonStr ).as[ List[String] ]orJson.parse( jsonStr ).as[ List[String] ].toBuffer.