Hi all,
I searched for an answer to my question but I could not find one. Sorry if I missed it.
I have JSON data that looks like this:
{
"someInfo": {
"size": -20.7,
"class": "fCls-blb2ff5z0o",
"150Stuff": {
"title": "no",
"identifier": "no"
},
In my pre-Request Script, I set ‘150Stuff’ to yes or no randomly.
I want to test that ‘150Stuff’ in the response matches what’s in my variable (either yes or no). I parse the JSON first:
var jsonDataNewJob = pm.response.json();
Then I have a test that looks like this:
pm.test('150Stuff matches variable', function () {
pm.expect(jsonDataNewJob.someInfo.150Stuff.title).to.eql(pm.environment.get('150Stuff'));
});
Postman doesn’t like the ‘150Stuff’ in the line: jsonDataNewJob.someInfo.150Stuff.title
and shows the error:
Unmatched '{'.
Any idea how I can get Postman to drill down to jsonDataNewJob.someInfo.150Stuff.title
without error?
Thanks so much in advance!
Ed