title: How to get the key value from nested object
body: <p>I am having below object where I am trying to get all the id values. </p>
  
  <pre><code>[{
      "type": "test",
      "id": "100",
      "values": {
          "name": "Alpha"
      },
      "validations": []
  }, {
      "type": "services",
      "validations": [{
          "id": "200",
          "name": "John",
          "selection": [{
              "id": "300",
              "values": {
                  "name": "Blob"
              }
          }]
      }]
  }]
  </code></pre>
  
  <p>Using the below code, I am getting only the first id value. Is there any way to get all the id values from the nested object without using any external module.</p>
  
  <pre><code>for (var prop in obj) {
              console.log(prop)
              if (prop === key) {
                  set.push(prop);
              }
          }
  </code></pre>
  
  <p>Expected Output</p>
  
  <pre><code>[100,200,300]     //all id values
  </code></pre>