0

I am trying to parse a json string using Json Methods , but i face below issue

spark-shell --jars /home/training/surender_hadoop/jars/json4s-native_2.11-3.6.7.jar 

 scala>  import org.json4s._
import org.json4s._

scala>
 |  import org.json4s.native.JsonMethods._
import org.json4s.native.JsonMethods._

scala>  val customJson = """{
 |  "empId":"100",
 |  "empSkils": ["hadoop", "spark"]
 |  }"""
customJson: String =
{
 "empId":"100",
 "empSkils": ["hadoop", "spark"]
 }

scala> parse(customJson)
<console>:32: error: overloaded method value parse with alternatives:
  (in: org.json4s.JsonInput,useBigDecimalForDouble: Boolean,useBigIntForLong: 
 Boolean)org.json4s.JValue <and>
  (in: org.json4s.JsonInput,useBigDecimalForDouble: Boolean)org.json4s.JValue
 cannot be applied to (String)
       parse(customJson)
   ^

scala>

The json string is not parsed, can some one help

Surender Raja
  • 3,553
  • 8
  • 44
  • 80

0 Answers0