Remove brackets from property which is fetch from another response.
I have expand the response using below groovy script and set the property as well.
def json_s = new JsonSlurper()
response = context.expand('${Order_Details#Response}')
json_response1 = json_s.parseText(response)
//response = response.replace('[]','')
testRunner.testCase.setPropertyValue("productSKU", String.valueOf(json_response1.extension_attributes.shipping_assignments.items.product_id))
Property got set as = [[5885]]
Response of Order_Details is:
"extension_attributes": {
"shipping_assignments": [ {
"shipping": {
"address": {
"address_type": "shipping",
},
"method": "simpleshipping_simpleshipping",
"total": {
"base_shipping_amount": 0,
"base_shipping_discount_amount": 0,
}
},
"items": [ {
"product_id": 3245,
"base_amount_refunded": 0,
"updated_at": "2021-08-26 13:38:25",
"weight": 0.374
}]
}]
now, I have remove the [[ ]] from property. How can I achieve with groovy.