Forum Discussion

bgoh29's avatar
bgoh29
Occasional Contributor
2 years ago

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

  • { {"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