title: How to split a JSON array to multiple JSONs using scala spark
body: <p>I have an array JSON as below format</p>
  <pre><code>{
    &quot;marks&quot;: [
      {
        &quot;subject&quot;: &quot;Maths&quot;,
        &quot;mark&quot;: &quot;80&quot;
      },
      {
        &quot;subject&quot;: &quot;Physics&quot;,
        &quot;mark&quot;: &quot;70&quot;
      },
      {
        &quot;subject&quot;: &quot;Chemistry&quot;,
        &quot;mark&quot;: &quot;60&quot;
      }
    ]
  }
  </code></pre>
  <p>I need to split each array object as separate JSON files. Is there any way to do this in spark shell.</p>