title: How can I use Gson in Scala to serialize a List?
body: <p>I was hoping to use Scala and Gson together. It seems to mostly work, but when I do something like this, it treats the list as an object, not an array:</p>
  
  <pre><code>case class MyType (val x:String, val y:List[SomeOtherType]) {
      def toJson() = new Gson().toJson(this)
  }
  </code></pre>
  
  <p>And my JSON turns out something like this:</p>
  
  <pre><code>{
      "x":"whatever",
      "y": {
  
      }
  }
  </code></pre>
  
  <p>Normally Gson converts lists to arrays. I'm sure this is all because Gson doesn't know about Scala's collection classes, but any ideas on what I can do to make this work? Or other suggestions using Scala-native JSON libraries?</p>