title: How to handle keys in Json with special characters in spark parquet?
body: <p>I am trying to create data frame from json in parquet format. I am getting following exception,</p>
  
  <blockquote>
    <p>Exception in thread "main" org.apache.spark.sql.AnalysisException: Attribute name "d?G?@4???[[l?~?N!^w1   ?X!8??ingSuccessful" contains invalid character(s) among " ,;{}()\n\t=". Please use alias to rename it.;</p>
  </blockquote>
  
  <p>I know that some json key having special characters is a reason for above exception. However, I do not know how many keys have special characters.</p>
  
  <p>Also, one possible solution is to replace special characters in keys with underscore or blank while creating RDD and reading line by line. </p>
  
  <p>I am creating parquet file using following code,</p>
  
  <pre><code>  dataDf.coalesce(1)
    .write
    .partitionBy("year", "month", "day", "hour")
    .option("header", "true")
    .option("delimiter", "\t)
    .format("parquet")
    .save("events")
  </code></pre>