I have a json response object like this:
"results": [
{
"seq": "882818::048313",
"id": "user1"
}
]
}
I have the entire json payload and id field name stored in 2 separate variables:
var jsonObj = pm.response.json();
var myfield = "id";
What I would like to do is below:
console.log("Value of id is: " + eval(jsonObj) + eval(".") + eval(myField));
I tried this way and getting error: Unexpected identifier.
I don't want to hardcode the name of the property but instead make it dynamic.
Please help.