I have csv
name,capital,zone,code,address,city,zip,state,phone,email
Test City,false,America,us,Address line 2,New York,10002,NY,(+1) 111-111-1112,[email protected]
What I do
import groovy.json.JsonBuilder
def json = new JsonBuilder()
json {
name vars.get("name")
capital vars.get("capital")
zone vars.get("zone")
code vars.get("code")
address vars.get("address")
city vars.get("city")
zip vars.get("zip")
state vars.get("state")
phone vars.get("phone")
email vars.get("email")
}
sampler.addNonEncodedArgument("",json.toPrettyString(),"")
sampler.setPostBodyRaw(true)
But csv could consist with multiple amount of rows and not every time a need all rows from csv
So, I need some variable which will be set some counter for loop, read counter=rows from csv and return me JSON
Try to found solution here, but always have troubles with syntax while Im noob in Groovy(
As result, it should be 1 request, 1 payload, with multiple items=rows from csv