title: How to convert DataFrame to Json?
body: <p>I have a huge JSON file, a small part from it as follows:</p>
  <pre><code>{
      &quot;socialNews&quot;: [{
          &quot;adminTagIds&quot;: &quot;&quot;,
          &quot;fileIds&quot;: &quot;&quot;,
          &quot;departmentTagIds&quot;: &quot;&quot;,
          ........
          ........
          &quot;comments&quot;: [{
              &quot;commentId&quot;: &quot;&quot;,
              &quot;newsId&quot;: &quot;&quot;,
              &quot;entityId&quot;: &quot;&quot;,
              ....
              ....
          }]
      }]
      .....
      }
  </code></pre>
  <p>I have applied lateral view explode on socialNews as follows:</p>
  <pre><code>val rdd = sqlContext.jsonFile(&quot;file:///home/ashish/test&quot;)
  rdd.registerTempTable(&quot;social&quot;)
  val result = sqlContext.sql(&quot;select * from social LATERAL VIEW explode(socialNews) social AS comment&quot;)
  </code></pre>
  <p>Now I want to convert back this result (DataFrame) to JSON and save into a file, but I am not able to find any Scala API to do the conversion.
  Is there any standard library to do this or some way to figure it out?</p>