title: Spark scala - parse json from dataframe column and return RDD with columns
body: <p>I have a sparkScala <code>RDD</code> that looks like this :</p>
  
  <pre><code>df.printSchema()
  
   |-- stock._id: string (nullable = true)
   |-- stock.value: string (nullable = true)
  </code></pre>
  
  <p>Second column of the <code>RDD</code> is a nested <code>JSON</code> :</p>
  
  <pre><code>[ { ""warehouse"" : ""Type1"" , ""amount"" : ""0.0"" }, { ""warehouse"" : ""Type1"" , ""amount"" : ""25.0"" }]
  </code></pre>
  
  <p>I need to generate an <code>RDD</code> that will contain the existing two columns but also the columns from the <code>JSON</code> like:</p>
  
  <pre><code>_id, value , warehouse , amount
  </code></pre>
  
  <p>I've tried to do it using custom functions, but I'm struggling to apply this function to my <code>RDD</code> and getting the needed result</p>
  
  <p><code>import org.json4s.jackson.JsonMethods._</code></p>
  
  <p><code>import org.json4s._</code></p>
  
  <pre><code> def extractWarehouses (value: String)  {
      val json = parse(value)
      for {
        JObject(warehouses) &lt;- json
        JField("warehouse", JString(warehouse)) &lt;- warehouses
        JField("amount", JDouble(amount)) &lt;- warehouses
      } yield (warehouse, amount)
    }
  </code></pre>