title: How to write valid json in spark
body: <p>I need to write valid json but spark allows to write single row at a time like:</p>
  
  <pre><code>{"name":"Yin", "address":{"city":"Columbus","state":"Ohio"}}
  {"name":"Michael", "address":{"city":null, "state":"California"}}
  </code></pre>
  
  <p>Above Json is not valid. Instead I need this:</p>
  
  <pre><code>{
  {"name":"Yin", "address":{"city":"Columbus","state":"Ohio"}},
  {"name":"Michael", "address":{"city":null, "state":"California"}}
  }
  </code></pre>
  
  <p>How Can i achieve it in java?</p>