Hi All,
Iβm trying to transform the JSON body of the request into a string formatted as βkey1=value1&key2=value2&key3=value3β. I have a regular JavaScript line that works great:
const bodySignParams = Object.entries(params).map(([key, val]) => key + β=β + val).join(β&β);
where βparamsβ is a JSON object
If I use it in an online Javascript sandbox, the result is perfect. If I try this in Postman, it interprets every character and not the key/value pair, even if I do JSON.parse(params) β so if the input is
{ βbaβ: βsheepβ, βhaveβ: βwoolβ }
the output is
0={&1=β&3=b&4=a&5=β β you get the idea.
in this case, the output should be
ba=sheep&have=wool
How can I get Postman to treat it as key/value pairs instead of a string?
This is in the pre-request script at the collection level.