title: Nested JSON in Spark
body: <p>I have the following JSON loaded as a DataFrame:</p>
  
  <pre class="lang-none prettyprint-override"><code>root
   |-- data: struct (nullable = true)
   |    |-- field1: string (nullable = true)
   |    |-- field2: string (nullable = true)
   |-- moreData: array (nullable = true)
   |    |-- element: struct (containsNull = true)
   |    |    |-- more1: string (nullable = true)
   |    |    |-- more2: string (nullable = true)
   |    |    |-- more3: string (nullable = true)
  </code></pre>
  
  <p>I want to get the following RDD from this DataFrame:</p>
  
  <pre class="lang-none prettyprint-override"><code>RDD[(more1, more2, more3, field1, field2)]
  </code></pre>
  
  <p>How can I do this? I think I have to use <code>flatMap</code> for the nested JSON?</p>