cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

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

Try this:

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

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

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, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal