Kumar112
Kumar112

Reputation: 224

karate match throws an error com.intuit.karate.exception.KarateException: Character '.' on position 3 is not valid

I am trying perform match on tis json array. Scenario goes like this

    Scenario : match lob
    * def op = 
    """
    [
     {
      "_id": "1",
      "_class": 
          "com.xxx.versionone.tir.enterprise.persistence.model.xxx",
      "lobName": "abc",
      "changeDate": "2016-11-04T11:41:40",
      "changedBy": "abc",
      "createdDate": "2014-07-01T11:47:23",
      "lastSdpPublishDate": "2018-10-31T00:00:00"
  },
  {
    "_id": {
           "$oid": "57883a41e4b076d23a82e9e7"
           },
     "_class": 
  "com.xxx.versionone.tir.enterprise.persistence.model.xxx",
    "lobName": "asda",
    "changeDate": "2016-07-14T21:20:54",
     "changedBy": "TXA858",
     "createdDate": "2016-07-14T21:20:01",
     "createdBy": "TXA858",
     "lastSdpPublishDate": "2018-10-31T00:00:00"
     }
    ]
"""
* match $op...lobName contains ["abc"]

I get this error: com.intuit.karate.exception.KarateException: Character '.' on position 3 is not valid. at com.intuit.karate.StepDefs.matchNamed(StepDefs.java:540) at com.intuit.karate.StepDefs.matchContains(StepDefs.java:532)

Upvotes: 1

Views: 894

Answers (1)

Babu Sekaran
Babu Sekaran

Reputation: 4239

JSON path deep scan is .. not ...

This should work,

* match $op..lobName contains ["abc"]

Json path operators

Upvotes: 1

Related Questions