What parse and/or setEnvironmentVariable statement(s) must i use to get C2 from { "C1:C2"}?

Tien Le
Tue, 14 Nov 2017 22:55:02 +0000
Help Hub

Hi,

May I get some help with using the proper parse and/or setEnvironmentVariable so that I can write a needed value to my environment variable?

I’m getting a response of

[
  {
    "A": "B",
    "C": "D",
    "E": [
           "F1:F2",
           "G1:G2",
           "H1:H2"
    ],
    "I1": "I2",
    "J1": "J2"
  }
]

I’m thinking that my postman.setEnvironmentVariable(“F”, );

I’ve tried
var jsonData = JSON.parse(E[0].F1);
postman.setEnvironmentVariable(“serviceTypeId”, jsonData[1]);
but it’s not working.

I know that the var statement isn’t quite correct. What should it be? I probably don’t have the setEnvironmentVariable statement correct either.

help!

thanks,
Tien

3 posts - 2 participants