Ask a Question

how do I change the input value within JSON in the request body

SOLVED
bgoh29
Occasional Contributor

how do I change the input value within JSON in the request body

I want to modify the values within JSON in the request body. Here's an example of the request body

 

{  "driverId":  "${userInfo#Respoinse#$id}, 

"otherDetails" : "${driverDetails#Response#$details}"

 

I want to reverse the string value of parameter otherDetails. 

I have tried a few combinations  and none of them works

 

  • ${driverDetails#Response#$details.reverse()} 
  • ${driverDetails#Response#$details}.toString().reverse()
  • $({driverDetails#Response#$details}).reverse()
  • ${${driverDetails#Response#details}.reverse()} 

 

Appreciate some help here. 

How do I reverse the string value within the ${ } or there are other ways to do that? 

 

1 REPLY 1
KarelHusa
Champion Level 3

We need to use ${=} to execute the Groovy code. And inside the code we can use the SoapUI property.

 

An example:

${="${#TestCase#petName}".reverse()}

 Please note that the quotes make a string object, otherwise it would be treated as an identifier.

 

Best regards,

Karel

 

Karel@apimate.eu
https://apimate.eu
cancel
Showing results for 
Search instead for 
Did you mean: