Home > Software design >  How to validate the JSON key from global variables using javascript
How to validate the JSON key from global variables using javascript

Time:12-26

I am new to javascript, can someone help me how can I validate the JSON key from global variables using javascript in Postman.

I want to read the dd value(1566) by passing the ID value from global variables. Please refer the screenshot attached which contains my response and the validation code written.

CodePudding user response:

You only need to change this.

console.log(adLength.pm.globals.get('ID').cmps.dd)

to

console.log((resp.data.result.asi[`${pm.globals.get('ID')}`].cmps.dd)
  • Related