title: Scala - Writing Json object to file and reading it
body: <p>I have a Map like below </p>
  
  <pre><code>val map : scala.collection.mutable.Map[String,Any] = Map(
    dummy1 -&gt; ["cat1", "hash1", 101, 1373269076, {"1" : ["dummy", "dummy", "dummy"]}],
    dummy2 -&gt; ["cat1", "hash1", 102, 1373269076, {"2" : ["dummy", "dummy", "dummy"]}],
    dummy3 -&gt; ["cat1", "hash1", 103, 1373269076, {"3" : ["dummy", "dummy", "dummy"]}]
  )
  </code></pre>
  
  <p>I converted it into a Json string and then wrote it into a file with the code below</p>
  
  <pre><code>Some(new PrintWriter("foo.txt")).foreach{p =&gt;
    p.write(JSONObject(map.toMap).toString()); p.close
  }
  </code></pre>
  
  <p>Am able to read the Json string from the file using </p>
  
  <pre><code>val json_string = scala.io.Source.fromFile("foo.txt").getLines.mkString
  </code></pre>
  
  <p>How do I get my map back from the Json string above?</p>
  
  <p><strong>EDIT:</strong>  Am able to read the map with </p>
  
  <pre><code>val map1 = JSON.parseFull(json_string).get.asInstanceOf[Map[String,Any]]
  </code></pre>
  
  <p>But, this process is taking more time as the size of the map increases.</p>