Forum Discussion

karthick2490's avatar
karthick2490
Occasional Visitor
6 years ago

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.

 

 

 

 

  • JHunt's avatar
    JHunt
    Community Hero

    Try this:

    testRunner.testCase.setPropertyValue("SAP", json_response.SAP.toString()[1..-2])
  • 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