title: Spark convert PairRDD to RDD
body: <p>What is the best way to convert a PairRDD into an RDD with both K and V are merged (in java)?</p>
  
  <p>For example, the PairRDD contains K as some string and V as a JSON. I want to add this K to the value JSON and produce an RDD.</p>
  
  <p><strong>Input PairRDD</strong></p>
  
  <pre><code>("abc", {"x:"100", "y":"200"})
  ("def", {"x":"400", "y":"500")
  </code></pre>
  
  <p><strong>Output should be and RDD as follows</strong></p>
  
  <pre><code>({"x:"100", "y":"200","z":"abc"})
  ({"x":"400", "y":"500","z":"def"})
  </code></pre>