Forum Discussion

bpistole's avatar
bpistole
Contributor
7 years ago

How do I create a key/value array.

I'm new to SoapUI Pro, I've been using it just a couple of weeks so far.

 

I am executing a REST API call and one of the parameters requires a key/value array.

Request: api/search/event?&secTags[0][tagTypeId]=122&secTags[0][value]=three&&activePage=1

 

 

Here's how I am trying to create the key/value array:

def secTagsArray= new groovy.json.JsonBuilder()


secTagsArray{
       tagTypeId "122"
       value "three"
}

 

I am not sure if that is correct because I am unable to figure out how to take that secTagsArray variable and insert it into the proper REST Request parameter.

 

Any help would be greatly appreciated.

 

Billy

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    What should be the desired json request in your case?
  • So the issue here turned out to be a problem with the Swagger definitions.  It didn't interpret the object right so no matter how I formed the json it failed.  Once I figured that out I was able to make a couple of custom parameters and delete the incorrect one.  I'm still not getting the response I expect but at least I've got part of it resolved.

     

    Thanks