title: How to convert Scala Map into JSON String?
body: <p>For example, I have this Map value in Scala:</p>
  
  <pre><code>val m = Map(
      "name" -&gt; "john doe", 
      "age" -&gt; 18, 
      "hasChild" -&gt; true, 
      "childs" -&gt; List(
          Map("name" -&gt; "dorothy", "age" -&gt; 5, "hasChild" -&gt; false),
          Map("name" -&gt; "bill", "age" -&gt; 8, "hasChild" -&gt; false)
      )
  )
  </code></pre>
  
  <p>I want to convert it to its JSON string representation:</p>
  
  <pre><code>{
      "name": "john doe",
      "age": 18,
      "hasChild": true,
      "childs": [
          {
              "name": "dorothy",
              "age": 5,
              "hasChild": false
          },
          {
              "name": "bill",
              "age": 8,
              "hasChild": false
          }
      ]
  }
  </code></pre>
  
  <p>I'm currenly working on Play framework v2.3, but the solution doesn't need to use Play JSON library, although it will be nice if someone can provide both Play and non-Play solution.</p>
  
  <p>This is what I have done so far without success:</p>
  
  <pre><code>// using jackson library
  val mapper = new ObjectMapper()
  val res = mapper.writeValueAsString(m)
  println(res)
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>{"empty":false,"traversableAgain":true}
  </code></pre>
  
  <p>I don't understand why I got that result.</p>