Ask a Question

How to get rid of the curly brackets when using the expression $ {}

bgoh29
Occasional Contributor

How to get rid of the curly brackets when using the expression $ {}

Hi Community

When I use the ${} expression, i.e. ${GetChangedActiveJobIds#Response}, the raw request is { {"Ids":[306, 360]}} on the Custom Properties. How do I get rid of the outer curly brackets? what expression can I use? 

I need to pass {"Ids" : [306, 360]} to the API. 

 

1 REPLY 1
Shashavali
Contributor

{ {"Ids":[306, 360]}} -- this looks invalid json. see if the response is returning invalid json

expected Response:-

{
"id": 1,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": ["string"],
"tags": [ {
"id": 0,
"name": "string"
}],
"status": "available"
}

GroovyScript :-

def res = context.expand('${Req#Response}')
log.info res

 

Above GrooryScript returns below as response with adding extra curly braces 

 

cancel
Showing results for 
Search instead for 
Did you mean: