title: In Spark Json to Csv converting?
body: <p>I have a Json object like bellow</p>
  
  <pre><code>{"Event":"xyz","Name":"test","Prog":0,"AId":"367","CId":"11522"}         
  </code></pre>
  
  <p>using bellow spark script,I have converted into csv</p>
  
  <pre><code> val sqlContext = new org.apache.spark.sql.SQLContext(sc)
   val df = sqlContext.load("org.apache.spark.sql.json", Map("path" -&gt; "test1.json"))
   df.save("com.databricks.spark.csv", SaveMode.ErrorIfExists, Map("path" -&gt; "datascv", "header" -&gt; "true"))
  </code></pre>
  
  <p>I am able to convert  into CSV file,My Output is</p>
  
  <pre><code>AId,CId,Event,Name,Prog
  367,11522,xyz,test,0
  </code></pre>
  
  <p>but here header of csv is in ascending  order,but I want to maintain my csv file header in customized format like bellow i.e same as my json order.</p>
  
  <pre><code>Event,Name,Prog,AId,CIdEvent,Name,Prog,AId,CId
  </code></pre>
  
  <p>Please help me with this.</p>
  
  <p>Thanks in advance.</p>