Best way to convert a case class to a js.Object
<p>Say I have a case class:</p>

<pre><code>case class Name(first: String, last: String)
val n1 = Name("John", "Doe")
val n2 = Name("Mary", "Doe")
</code></pre>

<p>and I have a java script object:</p>

<pre><code>@js.native
trait MyJSObject extends js.Object { 
  def add(name: js.Object): Unit = js.native 
}
</code></pre>

<p>such that name should be of the format</p>

<pre><code>{"first":"John","last":"Doe"}
</code></pre>

<p>What is the best way to convert my case object to a js.Object?</p>

<p>I know this can be achieved doing a upickle.write() to convert it to a json String so I guess my question is is this the best way?</p>