title: Scala error: object XML is not a member of package org.json on Apache Spark
body: <p>I am trying to execute the followng scala code but I keep on getting the following error:</p>
  <p>command-3313750897057320:1: error: object XML is not a member of package org.json</p>
  <p>The full error looks like the following:</p>
  <p><a href="https://i.stack.imgur.com/BdgbS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BdgbS.png" alt="enter image description here" /></a></p>
  <p>The code is as follows:</p>
  <pre><code>import org.json.XML
  import scala.util.Try
  
  val parseXmlToJson = udf((value: String) =&gt; 
                           try{
                               XML.toJSONObject(value).toString
                           }
                           catch{
                             case e: Exception =&gt; &quot;Processing Error&quot;
                           }
                          )
    // Defined UDF to parse xml to json
  
  spark.udf.register(&quot;XmlToJson&quot;, parseXmlToJson)
  </code></pre>
  <p>The objective of the code is to convert/parse XML to JSON.</p>