Send JSON as request param at GET request

Hi people,

Im trying to do some testing from Swagger API, and I found out some GET request have JSON format objects as request parameters, so I am trying to find out a way to send a JSON object as a parameter.

Is there any option?

Hi @albertoalonsosaavedr

I haven’t done it before, but my guess would be that in a pre-req script you would need to convert the object to a string and then URL encode that string… then pass the output into the param.

Something like this;

let JSONobject = '{"name":"John", "age":30, "car":null}'
let JSONasString = JSONobject.toString();
console.log(JSONasString);
let encoded = encodeURIComponent(JSONasString);
console.log(encoded);