0

in Jmeter, for the message below i want to get the value of tag CC2650HumidityData (or tag name and tag value) but I don't know the name of tag; it is contained in a variable. I've used this json path:

$.message.inputData[*].${tagName}
$.message.inputData[*].vars.get("tagName")

but without success. This is an example of message:

{
    "message": {
        "inputData": [
            {
                "CC2650HumidityData": "51",
                "dateTime": "2020-12-18T08:35:21.342Z"
            },
            {
                "CC2650BarometricPressureData": "21",
                "dateTime": "2020-12-18T08:35:15.136Z"
            }
        ]
    }
}

Could you help me?

Mario Petrovic
  • 7,500
  • 14
  • 42
  • 62
sarjaana
  • 77
  • 1
  • 1
  • 6

1 Answers1

0

Your first option, to wit this one: $.message.inputData[*].${tagName} should work just fine

enter image description here

Just make sure that your tagName variable exists and has the anticipated value, it can be done using Debug Sampler and View Results Tree listener combination

Also be aware that you won't be able to use JSONPath Tester mode of the View Results Tree listener for testing JSONPath queries as it doesn't evaluate variables, you will need to run your test to see the variables values (or use this Dummy Sampler like I did)

Dmitri T
  • 159,985
  • 5
  • 83
  • 133