Modify json string from response in scala

479 views Asked by At

I am trying to parse json using lift json in scala which I received from post call as a response string and update fields in json and then make put call with the modified json.

Response string  {"id":x,"status":"xxx","Ip":xxxx}

I want to modify status

val response=Post()
    val res = raw"""$response"""
    implicit val formats = DefaultFormats
    case class JsonData(id: Int, status:String,Ip:String)
      val json = parse(res)
        val m = json.extract[JsonData]
    println(m.id)

Exception :

Exception in thread "main" java.lang.NoClassDefFoundError: com/thoughtworks/paranamer/Paranamer at net.liftweb.json.Extraction$.net$liftweb$json$Extraction$$mkMapping$1(Extraction.scala:194) at net.liftweb.json.Extraction$.net$liftweb$json$Extraction$$extract0(Extraction.scala:199) at net.liftweb.json.Extraction$.extract(Extraction.scala:43) at net.liftweb.json.JsonAST$JValue.extract(JsonAST.scala:312) at mytest.TestApi$.main(TestApi.scala:38) at mytest.TestApi.main(TestApi.scala) Caused by: java.lang.ClassNotFoundException: com.thoughtworks.paranamer.Paranamer at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more

0

There are 0 answers