I am trying to extract some particular fields from json list response
following snapshot shows the json expression
How can i store this response i.e., name and id to a csv file. please suggest the best solution.
Thanks in advance!!
I am trying to extract some particular fields from json list response
following snapshot shows the json expression
How can i store this response i.e., name and id to a csv file. please suggest the best solution.
Thanks in advance!!
You can go for JSR223 Listener and Groovy language, the relevant code would be something like:
1.upto(vars.get('enrolledDevices_matchNr') as int, { idx ->
def enrolledDevice = new groovy.json.JsonSlurper().parseText(vars.get('enrolledDevices_' + idx))
new File('myfile.csv') << enrolledDevice.name << ',' << enrolledDevice.id << System.getProperty('line.separator')
})
More information: Groovy Parsing and producing JSON