title: Spark get column names of nested json
body: <p>I'm trying to get column names from a nested JSON via DataFrames. The schema is given below: </p>
  
  <pre><code>root
   |-- body: struct (nullable = true)
   |    |-- Sw1: string (nullable = true)
   |    |-- Sw2: string (nullable = true)
   |    |-- Sw3: string (nullable = true)
   |    |-- Sw420: string (nullable = true)
   |-- headers: struct (nullable = true)
   |    |-- endDate: string (nullable = true)
   |    |-- file: string (nullable = true)
   |    |-- startDate: string (nullable = true)
  </code></pre>
  
  <p>I can get the column names "body" and "header" with df.columns() but when I try to get the column names from the body (ex: Sw1, Sw2,...) with df.select("body").columns it always give me the body column.</p>
  
  <p>Any suggestion? :)</p>