Search code examples
jsonjsonpath

Building json path expression - presence of DOT in attribute name


We are working with a legacy system which gives json responses. We trying to test these json endpoints with jmeter. So, we are trying to use the json path extractor plugin for the purpose. But the structure of the json path is causing an issue in creating json path expressions.

The structure of the json which we are receiving from the server is as follows.

  {   
"ns9.Shopping": {
"transactionID": "XXXXXNEKIHJO7SRHN1",
"transactionStatus": "Success",
"ns9.shoppingResponseIDs":     {
    "ns9.owner": "1P",
    "ns9.responseId": "abcdefghijklmnop"
},
"ns9.offersGroup": {"ns9.thanksGiving":     [
            {
        "ns9.owner": "DL",
        "ns9.retailOffer":             [
                            {
                "ns9.offerId": "offer1DL",
                "ns9.price": 2639.08,
                "ns9.currencyCode": "USD",
                "ns9.taxTotal": 961.08,
                "ns9.taxCode": "USD",
               .........

The presence of . [DOT] in the attribute name is causing issues in my json path expression.

In short, can some one help in finding the "transactionID" from "ns9.Shopping"?


Solution

  • You can try to add Regular Expression Extractor within your HTTP Request element.

    Put this regex:

    "transactionID": "([a-zA-Z0-9]*)"
    

    enter image description here

    I hope this will help you.