Create a POST request using https://postman-echo.com/post
And in Body > Raw enter your JSON variable name;
In your pre-req script, put this code;
const jsonResponse = JSON.parse(pm.collectionVariables.get("json"));
console.log(jsonResponse);
let x = jsonResponse.item;
x.sort((a, b) => {
let fa = a.name.toLowerCase(),
fb = b.name.toLowerCase();
if (fa < fb) {
return -1;
}
if (fa > fb) {
return 1;
}
return 0;
});
let y = JSON.stringify(x);
pm.collectionVariables.set("myJSON",y);
Then in the ‘Tests’ tab, build the new JSON structure like this;