title: Pyspark: Create Schema from Json Schema involving Array columns
body: <p>I have defined my schema for the df in a json file as follows:</p>
  
  <pre><code>{
      "table1":{
          "fields":[
              {"metadata":{}, "name":"first_name", "type":"string", "nullable":false},
              {"metadata":{}, "name":"last_name", "type":"string", "nullable":false},
              {"metadata":{}, "name":"subjects", "type":"array","items":{"type":["string", "string"]}, "nullable":false},
              {"metadata":{}, "name":"marks", "type":"array","items":{"type":["integer", "integer"]}, "nullable":false},
              {"metadata":{}, "name":"dept", "type":"string", "nullable":false}       
          ]
      }
  
  }
  </code></pre>
  
  <p>EG JSON DATA:</p>
  
  <pre><code>{
      "table1": [
          {
              "first_name":"john",
              "last_name":"doe",
              "subjects":["maths","science"],
              "marks":[90,67],
              "dept":"abc"        
          },
          {
              "first_name":"dan",
              "last_name":"steyn",
              "subjects":["maths","science"],
              "marks":[90,67],
              "dept":"abc"        
          },
          {
              "first_name":"rose",
              "last_name":"wayne",
              "subjects":["maths","science"],
              "marks":[90,67],
              "dept":"abc"            
          },
          {
              "first_name":"nat",
              "last_name":"lee",
              "subjects":["maths","science"],
              "marks":[90,67],
              "dept":"abc"        
          },
          {
              "first_name":"jim",
              "last_name":"lim",
              "subjects":["maths","science"],
              "marks":[90,67],
              "dept":"abc"        
          }       
      ]
  }
  </code></pre>
  
  <p>I want to create the equivalent spark schema from this json file. Below is my code: <em>(reference: <a href="https://stackoverflow.com/questions/40957585/create-spark-dataframe-schema-from-json-schema-representation">Create spark dataframe schema from json schema representation</a>)</em></p>
  
  <pre><code>with open(schemaFile) as s:
   schema = json.load(s)["table1"]
   source_schema = StructType.fromJson(schema)
  </code></pre>
  
  <p>The above code works fine if i dont have any array columns. But throws the below error if i have array columns in my schema.</p>
  
  <p>"Could not parse datatype: array"
  ("Could not parse datatype: %s" json_value)</p>