Is there a policy assertion or technique I can use efficiently to manipulate (modify existing attributes, or add/delete attributes) JSON response data to give back to the requestor?
"name": "First Last",
"address": "123 Address Dr, Paris, TX",
updated response - modify existing attribute:
updated response - add:
"new_attribute": "my new value"
updated response - delete:
"address": "123 Address Dr, Paris, TX"
I've looked at the JSONParse and the XMLParse assertions but they are used to convert from XML to JSON and vice versa. We also looked at policies where u could extract key values out of the JSON response to set as a value. Is there a way other than having to reconstruct the JSON response attribute-by-attribute to create any of the desired responses?
I have included a few techniques you can try for this use case:
Good thinking Mohindra.Singh.
For item 1 if you are unsure of the value or pattern to match (not always a SS #) you can use the 'Evaluate JSON Path Expression' to retrieve the value and feed it to the RegEx to replace.
Evaluate JSON Path Expression Assertion - CA API Gateway - 9.1 - CA Technologies Documentation