title: I am using apache spark to parse json files . How to get nested key from json files wheather it's array or nested key
body: <p>I have multiple json files which keeps json data init. Json Structure look like this.</p>
  
  <pre><code>{ 
    "Name":"Vipin Suman",
    "Email":"vpn2330@gmail.com",
   "Designation":"Trainee Programmer",
   "Age":22 ,
   "location":
      {"City":
             {
              "Pin":324009,
              "City Name":"Ahmedabad"
             },
      "State":"Gujarat"
     },
   "Company":
            {
             "Company Name":"Elegant",
             "Domain":"Java"
            }, 
   "Test":["Test1","Test2"]
  
  }
  </code></pre>
  
  <p>I tried this </p>
  
  <pre><code>    String jsonFilePath = "/home/vipin/workspace/Smarten/jsonParsing/Employee/Employee-03.json";
  
      String[] jsonFiles = jsonFilePath.split(",");
  
      Dataset&lt;Row&gt; people = sparkSession.read().json(jsonFiles);
  </code></pre>
  
  <p>i am getting schema for this is</p>
  
  <pre><code>root
   |-- Age: long (nullable = true)
   |-- Company: struct (nullable = true)
   |    |-- Company Name: string (nullable = true)
   |    |-- Domain: string (nullable = true)
   |-- Designation: string (nullable = true)
   |-- Email: string (nullable = true)
   |-- Name: string (nullable = true)
   |-- Test: array (nullable = true)
   |    |-- element: string (containsNull = true)
   |-- location: struct (nullable = true)
   |    |-- City: struct (nullable = true)
   |    |    |-- City Name: string (nullable = true)
   |    |    |-- Pin: long (nullable = true)
   |    |-- State: string (nullable = true)
  </code></pre>
  
  <p>i am getting the view of table:-</p>
  
  <pre><code>    +---+--------------+------------------+-----------------+-----------+--------------+--------------------+
  |Age|       Company|       Designation|            Email|       Name|          Test|            location|
  +---+--------------+------------------+-----------------+-----------+--------------+--------------------+
  | 22|[Elegant,Java]|Trainee Programmer|vpn2330@gmail.com|Vipin Suman|[Test1, Test2]|[[Ahmedabad,32400...|
  +---+--------------+------------------+-----------------+-----------+--------------+--------------------+
  </code></pre>
  
  <p>i want result as:-</p>
  
  <pre><code>            Age   |  Company Name    | Domain|  Designation |  Email           |    Name          |  Test   | City Name      |  Pin   |   State   |
  
             22     | Elegant MicroWeb | Java  |  Programmer  | vpn2330@gmail.com | Vipin Suman     | Test1  |  Ahmedabad      | 324009  | Gujarat 
             22     | Elegant MicroWeb | Java  |  Programmer  | vpn2330@gmail.com | Vipin Suman     | Test2  |  Ahmedabad      | 324009  | 
  </code></pre>
  
  <p>how i can get table in above formet. i tried out everything. I am new to apache spark can any one help me out??</p>