I have this json:
{
"deviceId": "deviceCustom",
"moduleId": "custom",
"properties": {
"desired": {
"settings": {
"ef78c18c-2291-4d15-ae87-d89abb9b1fef": {
"name": "elements",
"version": "1.0.0",
"category": "A1"
},
"f4b04c94-4643-4b13-b10c-9a00fbf4ea27": {
"name": "tags",
"version": "2.0.0",
"category": "B1"
}
}
}
}
}
and I would like to get separately all the objects under "settings". E.g:
settings_1="f4b04c94-4643-4b13-b10c-9a00fbf4ea27":{"name":"tags","version":"2.0.0","category":"B1"}
settings_2="ef78c18c-2291-4d15-ae87-d89abb9b1fef":{"name":"elements","version":"1.0.0","category":"A1"}
settings_matchNr=2
In Jmeter I've configured a JSON Extractor with this JSON Path expression: $.properties.desired.settings
but I got this result:
settings_1={"f4b04c94-4643-4b13-b10c-9a00fbf4ea27":{"name":"tags","version":"2.0.0","category":"B1"},"ef78c18c-2291-4d15-ae87-d89abb9b1fef":{"name":"elements","version":"1.0.0","category":"A1"}}
settings_matchNr=1
I've also tried to use JSR223 Post Processor with Slurper but no valid result. Could you help me on that?
Thanks in advance.
Add JSR223 PostProcessor as a child of the request which returns the above JSON
Put the following code into "Script" area:
That's it, you will be able to refer the extracted JSON Objects as
${setting_1}
and${setting_2}
More information: