how to convert dataframe to rdd(key string, json string) in spark
<p>I created dataframe from json below.</p>

<pre><code>val df = sqlContext.read.json("my.json")
</code></pre>

<p>after that, I would like to create a rdd(key,JSON) from a Spark dataframe. 
I found df.toJSON.
However, it created rdd[string].</p>

<p>i would like to create rdd[string(key), string(JSON)].
how to convert spark data frame to rdd(string(key), string(JSON)) in spark.</p>

<p>my dataframe looks like below.</p>

<pre><code> root
 |-- id: string (nullable = true)
 |-- name: string (nullable = true)
 |-- data: array (nullable = true)
 |    |-- element: struct (containsNull = true)
 |    |    |-- data1: string (nullable = true)
 |    |    |-- data2: double (nullable = true)
 |    |    |-- data3: double (nullable = true)
 |-- image: string (nullable = true)
 |-- flag: boolean (nullable = true)
</code></pre>