Pergunta

I can't find a way to extract array from a json response in Jmeter http request. All other fields i'm able to extract. However something like the following i cannot seem to extract. is there any way i can extract this from response in Jmeter http request? In the following i need to extract [1,2,3] and save it in a variable.

"days":[1,2,3]
"sectionIds":[abc,def,ghi]

something like the folliwing i can just extract using "subscriptionId":"(.+?)" in the jmeter regular expression extractor

"subscriptionId":"abcd"

time value can be extracted using this "time":(\d+)

"time": 120
Foi útil?

Solução

I guess you have problem with square braces not being quotted. Try:

"days":(\[.+?\])

or if you want to match numbers inside something like:

"days":(\[(\d+,?)+\])

Outras dicas

I don't think that Regex way is the best option to deal with JSON data.

There is a plugin called JSON Path Extractor which provides functionality alike to JMeter Embedded XPATH Extractor but targeting JSON.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top