Re: how to do transfer property from JSON without brackets?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2019
09:05 AM
08-16-2019
09:05 AM
Re: how to do transfer property from JSON without brackets?
testRunner.testCase.setPropertyValue("SAP", json_response.SAP.toString())
Property is stored as [1, 2, 3 , 4]
testRunner.testCase.setPropertyValue("SAP", String.valueOf(json_response.SAP[0]))
Result: 1
I would like to set the property values as 1, 2, 3, 4 without square braces not as [1, 2, 3 , 4]
Please help me.
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2019
03:20 PM
08-16-2019
03:20 PM
Try this:
testRunner.testCase.setPropertyValue("SAP", json_response.SAP.toString()[1..-2])
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2019
04:55 AM
08-19-2019
04:55 AM
Hi @karthick2490 ,
for(i=1; i<5;i++){ testRunner.testCase.setPropertyValue("SAP" , json_response.SAP[i].toString()); }
it will store values as :
SAP1
SAP2
SAP3
SAP4
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
