title: Parsing json in spark
body: <p>I was using json scala library to parse a json from a local drive in spark job :</p>
  
  <pre><code>val requestJson=JSON.parseFull(Source.fromFile("c:/data/request.json").mkString)
      val mainJson=requestJson.get.asInstanceOf[Map[String,Any]].get("Request").get.asInstanceOf[Map[String,Any]]
      val currency=mainJson.get("currency").get.asInstanceOf[String]
  </code></pre>
  
  <p>But when i try to use the same parser by pointing to hdfs file location it doesnt work:</p>
  
  <pre><code>val requestJson=JSON.parseFull(Source.fromFile("hdfs://url/user/request.json").mkString)
  </code></pre>
  
  <p>and gives me an error:</p>
  
  <pre><code>java.io.FileNotFoundException: hdfs:/localhost/user/request.json (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138)
    at scala.io.Source$.fromFile(Source.scala:91)
    at scala.io.Source$.fromFile(Source.scala:76)
    at scala.io.Source$.fromFile(Source.scala:54)
    ... 128 elided
  </code></pre>
  
  <p>How can i use Json.parseFull library to get data from hdfs file location ?</p>
  
  <p>Thanks</p>