title: How to parse a JSON document and extract an array?
body: <p>The code below produces an output as shown below which is wrong as per my expectation.</p>
  
  <p><a href="https://i.stack.imgur.com/wYSUW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wYSUW.png" alt="Wrong format"></a></p>
  
  <p>The format I expect to have is shown below. How can I achieve this? What am I doing wrong?</p>
  
  <p>I try and drill-down the structure to get a list of records from <code>dealerListItemDToes</code> array however I can't figure out a way to have it in the structure below.</p>
  
  <p><a href="https://i.stack.imgur.com/RpEcR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RpEcR.png" alt="CorrectFormat"></a></p>
  
  <pre><code>let responseData = {
    "_embedded": {
      "dealerListItemDToes": [
        {
          "id": "ab4b23bb-b58d-4012-93ea-702e37ea555a",
          "gssnID": "GSM00000001",
          "companyID": "GCM00000001",
          "mbID": "41010f",
          "name": "GINO RAG. FELICE &amp; FIGLIO - S.p.A.",
          "website": "http://www.gino.mercedes-benz.it",
          "phone": "+39 0171 410777",
          "country": "Italy",
          "city": "Madonna",
          "postalCode": "12100",
          "address": "Madonna dellolmo",
          "description": "description",
          "createdBy": "DataAdmin",
          "updatedBy": "DataAdmin",
          "createdAt": null,
          "updatedAt": null,
          "business": "PVU",
          "passengerCar": true,
          "van": true,
          "bus": false,
          "unimog": true,
          "truck": false
        },
        {
          "id": "b644a324-6858-4ac9-a2ce-a4539cee43a5",
          "gssnID": "GSM00000002",
          "companyID": "GCM00000002",
          "mbID": "42010e",
          "name": "L-AUTO. S.r.l.",
          "website": "http://www.lauto.mercedes-benz.it",
          "phone": "+39 0775 8859500",
          "country": "Italy",
          "city": "Frosinone",
          "postalCode": "3100",
          "address": "Via Enrico Fermi, 25",
          "description": "description",
          "createdBy": "DataAdmin",
          "updatedBy": "DataAdmin",
          "createdAt": null,
          "updatedAt": null,
          "business": "PTBU",
          "passengerCar": true,
          "van": false,
          "bus": true,
          "unimog": true,
          "truck": true
        }
      ]
    },
    "_links": {
      "first": {
        "href": "http://localhost:8080/api/v1/dealers?direction=ASC&amp;pageSize=10&amp;page=0&amp;size=10&amp;sort=gssnID,asc"
      },
      "self": {
        "href": "http://localhost:8080/api/v1/dealers?direction=ASC&amp;pageSize=10&amp;page=0&amp;size=10&amp;sort=gssnID,asc"
      },
      "next": {
        "href": "http://localhost:8080/api/v1/dealers?direction=ASC&amp;pageSize=10&amp;page=1&amp;size=10&amp;sort=gssnID,asc"
      },
      "last": {
        "href": "http://localhost:8080/api/v1/dealers?direction=ASC&amp;pageSize=10&amp;page=2&amp;size=10&amp;sort=gssnID,asc"
      }
    },
    "page": {
      "size": 10,
      "totalElements": 27,
      "totalPages": 3,
      "number": 0
    }
  };
  
  function getDataRecords(providedData: any): Array&lt;any&gt; {
    const dataSet: Array&lt;any&gt; = Object.entries(providedData._embedded)[0];
    dataSet.splice(0, 1); // Delete first property as its name can vary
    return dataSet;
  }
  
  console.log(getDataRecords(responseData));
  </code></pre>