title: Spark SQL read a JSON file which has already escaped double quote
body: <p>I have a simple Spark Program which reads a JSON file and emits a CSV file. In the JSON file data is escaped for double quote. The spark program is not able to read the line as a valid JSON string. </p>
  
  <p>input.json</p>
  
  <pre><code>{\"key\" : \"k1\", \"value1\": \"Good String\", \"value2\": \"Good String\"}
  </code></pre>
  
  <p>input_1.json</p>
  
  <pre><code>"{\"key\" : \"k1\", \"value1\": \"Good String\", \"value2\": \"Good String\"}"
  </code></pre>
  
  <p>output.csv - the data is coming back as corrupt record</p>
  
  <pre><code>_corrupt_record,key,value1,value2
  "{\\"key\\\" : \\\"k1\\\", \\\"value1\\\": \\\"Good String\\\", \\\"value2\\\": \\\"Good String\\\"}",,,
  </code></pre>
  
  <p>expected.csv</p>
  
  <pre><code>,k1,Good String,Good String
  </code></pre>
  
  <p>Please look at the main code below and advise</p>
  
  <pre><code>public static void main(String[] args) {
      SparkSession sparkSession = SparkSession.builder()
              .appName(TestSpark.class.getName()).master("local[1]").getOrCreate();
  
      SparkContext context = sparkSession.sparkContext();
      context.setLogLevel("ERROR");
      SQLContext sqlCtx = sparkSession.sqlContext();
  
      List&lt;StructField&gt; kvFields = new ArrayList&lt;&gt;();
      kvFields.add(DataTypes.createStructField("_corrupt_record", DataTypes.StringType, true));
      kvFields.add(DataTypes.createStructField("key", DataTypes.StringType, true));
      kvFields.add(DataTypes.createStructField("value1", DataTypes.StringType, true));
      kvFields.add(DataTypes.createStructField("value2", DataTypes.StringType, true));
      StructType employeeSchema = DataTypes.createStructType(kvFields);
  
      Dataset&lt;Row&gt; dataset = sparkSession.read()
                      .option("inferSchema", false)
                      .format("json")
                      .schema(employeeSchema)
                      .load("D:\\dev\\workspace\\java\\simple-kafka\\key_value.json");
  
      dataset.createOrReplaceTempView("sourceView");
      sqlCtx.sql("select * from sourceView")
              .write()
              .option("header", true)
              .format("csv")
              .save("D:\\dev\\workspace\\java\\simple-kafka\\output\\" + UUID.randomUUID().toString());
      sparkSession.close();
  }
  </code></pre>