Ask a Question

Re: how to do transfer property from JSON without brackets?

karthick2490
Occasional Visitor

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
JHunt
Community Hero

Try this:

testRunner.testCase.setPropertyValue("SAP", json_response.SAP.toString()[1..-2])
HimanshuTayal
Community Hero

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
cancel
Showing results for 
Search instead for 
Did you mean: