title: Extract value from array of objects in Postman
body: <p>I want to extract Id value from the array with objects in Postman and then set it as an environment variable. In case JSON response is an object, the following script works, but not with an array of objects (my array has only one object).</p>
  
  <pre><code>var data = JSON.parse(responseBody);
  postman.setEnvironmentVariable("userid", data.Id);
  </code></pre>
  
  <p>JSON response:</p>
  
  <pre><code>[
    {
      "Id": 1287,
      "LastName": "Trump",
      "FirstName": "Donald",
      "MiddleName": "Von",
      "City": "New York City",
      "Phone": "66 77 88",
      "State": "New York",
      "Fax": "111-222-333",
      "ReferenceId": "12345",
      "Active": false,
      "CurrentWorkingSchemeId": null
    }
  ]
  </code></pre>