How to create schema Array in data frame with spark
<p>I have code to create data frame and this works fine if there is no array in my input data. </p>

<p>I tried using Json data which doen't have array and it runs successfully.
My code is</p>

<pre><code>val vals = sc.parallelize(
  """{"id":"1","name":"alex"}""" ::
  Nil
)

val schema = (new StructType)
      .add("id", StringType)
      .add("name", StringType)


  sqlContext.read.schema(schema).json(vals).select($"*").printSchema()
</code></pre>

<p>My question is, if I have input data with array like below then how to create schema?</p>

<pre><code>     val vals = sc.parallelize(
  """{"id":"1","name":"alex","score":[{"keyword":"read","point":10}]}""" ::
  Nil
)


val schema = (new StructType)
      .add("id", StringType)
      .add("name", StringType)
</code></pre>

<p>Thanks.</p>