I have an API proxy and I passing json request in the body of request.
[{"status": "success", "ID":"200","UName":"xxxxx"}] and many more list of array..
I want to change the UName value. How to do it.
Solved! Go to Solution.
HI @Madhav
Welcome to the community !!!
You can do that using JavaScript policy.
The code is something like:
var body = JSON.parse(request.content); body.forEach(function(item){ item.UName = "newValue"; //set value }); request.content = ''; //To clear the request payload request.content = JSON.stringify(body);
NOTE: Make sure this policy is within the Request flow of either Proxy or Target end point
Hope this helps !