Service Virtualization

Expand all | Collapse all

Devtest is throwing jsonpath is invalid

  • 1.  Devtest is throwing jsonpath is invalid

    Posted Feb 06, 2019 05:41 PM

    I was trying to retrieve a data from the json response by passing the jsonpath through assertion. Below is the json response,

    "messageHeader": {
    "acknowledgement": "All",
    "messageType": "D",
    "credentials": {"alias": "TEST"},
    "sourceSystem": "test",
    "expiryTime": "2020-02-05T11:04:00.000+0000",
    "messageID": "1001.1",
    "correlationID": "AAO",
    "reply": {
    "reply.data": "\n\t\t FINAL \n\t",
    "reply.status": "failed"
    },
    "userId": "balurk",
    "trackingID": "DDD"
    }

     

    In this json, i'm trying to retrieve the text from "reply.data". I used the json path : $.messageHeader.reply.[reply.data]

    This jsonpath works fine when i use it in some jsonpath online sites. But the same is not working from Devtest run time and is throwing "The specified JSON path is invalid. JSON path = '$.messageHeader.reply.[reply.data]'". 

    Can someone please suggest some solutions?



  • 2.  Re: Devtest is throwing jsonpath is invalid

    Broadcom Employee
    Posted Feb 06, 2019 06:09 PM

    Which version of DevTest are you using?



  • 3.  Re: Devtest is throwing jsonpath is invalid

    Posted Feb 06, 2019 09:41 PM

    I'm using Devtest 10.1.0



  • 4.  Re: Devtest is throwing jsonpath is invalid
    Best Answer

    Posted Feb 07, 2019 08:55 AM

    Hi balu,

     

    Please use  json path as : $.messageHeader.reply.['reply.data']. The single quotes are missing in your json path. Please note that I have  tested it in 10.2

     

    Regards,

    Manik



  • 5.  Re: Devtest is throwing jsonpath is invalid

    Posted Feb 07, 2019 03:55 PM

    Thanks Manik, it worked fine now.