title: How to remove double quotes from keys in RDD and split JSON into two lines?
body: <p>I need to modify the data to give input to CEP system, my current data looks like below</p>
  
  <pre><code>val rdd = {"var":"system-ready","value":0.0,"objectID":"2018","partnumber":2,"t":"2017-08-25 11:27:39.000"}
  </code></pre>
  
  <p>I need output like </p>
  
  <pre><code>t = "2017-08-25 11:27:39.000
  Check = { var = "system-ready",value = 0.0, objectID = "2018", partnumber = 2 }
  </code></pre>
  
  <p>I have to write RDD map operations to achieve this if anybody suggests better option welcome. colcount is the number of columns.</p>
  
  <pre><code>rdd.map(x =&gt; x.split("\":").mkString("\" ="))                                                        
              .map((f =&gt; (f.dropRight(1).split(",").last.toString, f.drop(1).split(",").toSeq.take(colCount-1).toString))) 
              .map(f =&gt; (f._1, f._2.replace("WrappedArray(", "Check = {")))                                   
              .map(f =&gt; (f._1.drop(0).replace("\"t\"", "t"), f._2.dropRight(1).replace("(", "{")))              /
              .map(f =&gt; f.toString().split(",C").mkString("\nC").replace(")", "}").drop(0).replace("(", ""))    //  replacing , with \n, droping (
              .map(f =&gt; f.replace("\" =\"", "=\"").replace("\", \"", "\",").replace("\" =", "=").replace(", \"", ",").replace("{\"", "{"))
  </code></pre>