title: json4s: Convert type to JValue
body: <p>I have some source object <code>src</code> and would like to get a <code>JValue</code> from it. All the examples and documentation for json4s seem to revolve around getting a JSON-encoded string, like so:</p>
  
  <pre><code>def encodeJson(src: AnyRef): String = {
      import org.json4s.NoTypeHints
      import org.json4s.JsonDSL.WithDouble._
      import org.json4s.jackson.JsonMethods._
      import org.json4s.jackson.Serialization
      import org.json4s.jackson.Serialization.write
      implicit val formats = Serialization.formats(NoTypeHints)
  
      write(src)
  }
  </code></pre>
  
  <p>That's great if I only want the end result, but I'd prefer to write a:</p>
  
  <pre><code>def encodeJson(src: AnyRef): JValue
  </code></pre>
  
  <p>It seems like <a href="https://github.com/json4s/json4s/blob/master/core/src/main/scala/org/json4s/ToJsonWritable.scala"><code>ToJsonWritable[T]</code></a> is what I want to use, but I can't seem to find an implementation for <code>Writer[AnyRef]</code> (nor can I find scaladocs for json4s which would just tell me the implementations).</p>