I’m sorry, I don’t believe you. I understand the words you are writing, and I don’t believe they are true.
I built a proxy demonstrating what I described would happen, above. It takes the input, and wraps it in square brackets, and then sends that back in the response.
here’s a simple test illustrating how it works:
$ curl -i -X POST $endpoint/square-brackets/t1 -d '{"email":"xxx@xxx.com","field3":true,"utm_source":null}'
HTTP/2 200
content-length: 57
content-type: application/json
apiproxy: square-brackets r1
x-request-id: 8a8db449-0299-43ce-8147-385e81cb4e86
date: Tue, 11 Jan 2022 17:11:03 GMT
server: apigee
via: 1.1 google, 1.1 google
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
[{"email":"xxx@xxx.com","field3":true,"utm_source":null}]
As you can see it is not changing the quoting of the inbound payload. It simply wraps it in square brackets as I said.
It works with either JavaScript, like this:
<Javascript name='JS-Add-Square-Brackets'>
<Source>
context.setVariable('modified_content',
"[" + context.getVariable('request.content') + "]");
</Source>
</Javascript>
Or with an AssignMessage, like this:
<AssignMessage name='AM-Response-2'>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<Set>
<Payload contentType="text/plain">[{request.content}]</Payload>
<ReasonPhrase>OK</ReasonPhrase>
<StatusCode>200</StatusCode>
</Set>
<AssignTo>response</AssignTo>
</AssignMessage>
The results are the same.
The proxy is attached here.
Deploy it to your own environment and try it. It will work the way I described.
If you see changes in quotes in your proxy, You’re doing something in your proxy that is not quite in agreement with what you are claiming that are doing.
I don’t think the surest path to joy involves a session with Apigee support. Of course under your support contract (if you have one) you are welcome to open a ticket. They’ll not give you any information that is different than what I gave you here.
Instead, I think you can solve this yourself. Have a closer look at your own proxy, or engage the assistance of a buddy to look closely at what you’re doing in the proxy.