Accepted answer

You need to give a hint to the Scala compiler so that it is able to select the right method:

val eventType =[String](jsonString, "$.message_metadata.event_type")

Here is the complete test app:

import com.jayway.jsonpath.JsonPath

object TestApp extends App {
  val jsonString =
      |    "message_payload":"6b700b000006",
      |    "message_encryption_version":"2.0",
      |    "message_version":"1.0",
      |    "message_metadata":{
      |        "marketplace_id":"1",
      |        "workflow_id":"5906bd4e-52eb-4e2d-9a16-034fb67572f1",
      |        "hostname":"",
      |        "event_type":"MerchantRegistrationFraudEvaluation",
      |        "event_date":"1513665186657"
      |        }

  val eventType =[String](jsonString, "$.message_metadata.event_type")
  println(eventType)  // MerchantRegistrationFraudEvaluation

Related Query

More Query from same tag