title: Gson toJson escapes fields that are Option
body: <p>I have a case class like this:</p>
  
  <pre><code>case class TotalTest(f1: Option[String], f2: Option[String], f3: String)
  </code></pre>
  
  <p>Using <code>Gson</code>, I am trying to write the contents into a Json file, here's what I get:</p>
  
  <pre><code>
  val test1 = (new Gson).toJson(TotalTest(Some("a"), Some("b"), "c"))
  val pw1 = new PrintWriter(new File("test1.json" ))
  pw1.write(test1)
  pw1.close
  </code></pre>
  
  <p>The contents would be:</p>
  
  <pre><code>{"f1":{},"f2":{},"f3":"c"}
  </code></pre>
  
  <p>Why would I lose the first two fields? Basically I have a highly nested object of a case class with a lots of <code>Option</code>s and am wondering an easy way to extract the results. </p>
  
  <p><a href="https://stackoverflow.com/questions/41833279/scala-gson-cannot-serialize-optionblob">Related question</a></p>