Response transformer in JSON array


Hi, I was wondering if anybody can help me?

I am trying to run a response transformer in a golang api. For a better view, I receive the following when I trigger the sample below:

curl -i -X GET --url http://localhost:8000/ --header “Host: example”

“title”:“Power of Habit”,
“author”:“Charles Duhigg”,
“author”:“Stephen King”,

I have added a response transformer as below:
curl -X POST --url http://localhost:8001/apis/example-api/plugins --data “name=response-transformer” --data “config.remove.json=isbn”

but somehow I am still getting the same results. the isbn is still present. I’m I missing something?

Thank you in advance.


The reason that this doesn’t work is that the current transformations don’t work with JSON arrays AFAIK:

for _, name in iter(conf.remove.json) do
  json_body[name] = nil

It is a good idea though. E.g. add some detection of arrays here:

And if it is an array response, then do the remove in each object in array. Would you like to try send a pull-request for that?


Thank you for your reply @bungle!

I now understand the problem. I think the array checking would be useful.


A year after. Has this been implemented?