title: Convert scala Map to Json in play framework
body: <p>I am trying to convert a Map to Json in play framwork 2.6.x.
  The code is like</p>
  
  <pre><code>  def toJson(x:Map[String, Object]) = {
      import play.api.libs.json._
      Json.toJson(x)
    }
  </code></pre>
  
  <p>I got error <code>No Json serializer found for type Map[String,Object]. Try to implement an implicit Writes or Format for this type.</code></p>
  
  <p>The I add <code>writes</code> and code becomes:</p>
  
  <pre><code>  def toJson(x:Map[String, Object]) = {
      import play.api.libs.json._
      implicit val writes = Json.writes[Map[String, Object]]
      Json.toJson(x)
    }
  </code></pre>
  
  <p>I hit error. <code>No apply function found for scala.collection.immutable.Map</code></p>