title: Read Multilple json schema with spark
body: <p>Software Configuration:</p>
  
  <pre><code>Hadoop distribution:Amazon 2.8.3
  Applications:Hive 2.3.2, Pig 0.17.0, Hue 4.1.0, Spark 2.3.0
  </code></pre>
  
  <p>Tried to read with multiple json schema,</p>
  
  <blockquote>
    <p>val df = spark.read.option("mergeSchema",
    "true").json("s3a://s3bucket/2018/01/01/*")</p>
  </blockquote>
  
  <p>Throws an error, </p>
  
  <pre><code>org.apache.spark.sql.AnalysisException: Unable to infer schema for JSON. It must be specified manually.;
    at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$9.apply(DataSource.scala:207)
    at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$9.apply(DataSource.scala:207)
    at scala.Option.getOrElse(Option.scala:121)
    at org.apache.spark.sql.execution.datasources.DataSource.getOrInferFileFormatSchema(DataSource.scala:206)
    at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:392)
    at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:239)
    at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:227)
    at org.apache.spark.sql.DataFrameReader.json(DataFrameReader.scala:397)
    at org.apache.spark.sql.DataFrameReader.json(DataFrameReader.scala:340)
  </code></pre>
  
  <p>How to read json with multipl schema's with spark?</p>