I have seen several posts related to this, but I couldn't find a close match to my scenario, hence posting it as a new question.
I have a below JSON response
{
"myshop": [
{
"url": "test1",
"hits": 1000
},
{
"url": "test2",
"hits": 2000
},
{
"url": "test3",
"hits": 3000
}
]
}
I would like to extract each of URL, its corresponding hits, and store it in a CSV file, in this case, it would be 3 lines in the CSV file
test1,1000
test2,2000
test3,3000
but couldn't succeed in doing this. My JSON extractor:
$..url;$..hits with match number as -1
but it picks all the URLs but any random value of hits. Also, I was able to use a for each controller with one variable to extract from JSON, write it to CSV using BeanShell post processor successfully but the same doesn't work for this case. Any pointers would be helpful. I did check there were few answers with JSR223 Post processor but that did not cover this problem scenario.
Thanks in advance