Readyapiuser
9 years agoOccasional Contributor
How to convert json object into json string
Hi,
I am using Ready API 1.5.0. I have a json request with one of the value as- "value":12345. I have a groovy script where I get this json object through 'Get Data' and I am trying to add 1 in to make it from 12345 to 12346. But through groovy script what I get is json object so when I try to add 1, it comes as 123451, it is appending "1" to "12345" instead of adding it .
Can you please guide me how to convert json object into json string so that I can add number?
Thanks.
- By default the property value could be string.
If you need read it as integer, then add 'as int' at the end. Like
def value = context.testCase.getPropertyValue('PROPERTY_NAME') as int
You may also see Message 4 in the below thread
http://community.smartbear.com/t5/SoapUI-Open-Source/Groovy-Test-Step-not-running-while-integrated-into-Jenkins/m-p/109143#M18806