title: To filter out the missing keys after comparing two json objects(used js filter but doesnt work for all the scenarios)
body: <p>I have a functionality where I enable the user to edit the json object and then validate it in my code, so I have 2 json objects to compare and validate(the initial and the edited one) , I am pushing all the keys from json object into 2 different arrays and then comparing the first array to second and filtering out the missing keys.</p>
  
  <p>The code works for rest of the scenarios(if I remove keys which has an object) but fails if the json has a key which has an array of objects and also starts filtering out the keys which has not been removed.</p>
  
  <p><em>Ex: conditionals, order when removed starts showing all the keys under conditionals as filtered out</em></p>
  
  <p>But if I remove keys under alert or offset it shows correct number and name of keys filtered out.</p>
  
  <p><strong>note</strong>:- for the stackblitz example I have written same function twice</p>
  
  <pre><code>let defaultJsonFormFields = [];
  let editedJsonFormFields = []
  
  function keyList1(obj){
      Object.keys(obj).forEach(function (key) {
          defaultJsonFormFields.push(key);
          if (typeof (obj[key]) == 'object') {
              keyList1(obj[key]);
          }
      });
  };
  
  function keyList2(obj){
      Object.keys(obj).forEach(function (key) {
          editedJsonFormFields.push(key);
          if (typeof (obj[key]) == 'object') {
              keyList2(obj[key]);
          }
      });
  };
  
  
  keyList1(defaultjson);
  keyList2(editedjson);
  
  console.log(defaultJsonFormFields);
  console.log(editedJsonFormFields);
  
  let result = defaultJsonFormFields.filter(item =&gt; editedJsonFormFields.indexOf(item) == -1)
  
  console.log(result)
  </code></pre>
  
  <p><strong>[stackblitzlink]</strong>
  <a href="https://stackblitz.com/edit/js-qkgdoa?file=index.js" rel="nofollow noreferrer">https://stackblitz.com/edit/js-qkgdoa?file=index.js</a></p>
  
  <pre><code>let defaultjson =
   {
      "conditionals": [
          {
              "order": "1",
              "key": "gefvsgwer",
              "value": "dghthdffbhrthrdvgrthtuem",
              "grpOperation": "wrfllkwjflmefveveveve",
              "condition": "&gt;"
          }
      ],
      "offset": "15",
      "alert": {
      "mAlertType": "so new thing",
      "mTitle": "abcdef",
      "mMessage": "ok so be it",
      "mNotificationMsg": "whatever",
      "mSeverity": "LOW",
      "mEnabled": "true"
      }
  }
  
  let editedjson = {
      "": [
          {
              "": "1",
              "key": "gefvsgwer",
              "value": "dghthdffbhrthrdvgrthtuem",
              "grpOperation": "wrfllkwjflmefveveveve",
              "condition": "&gt;"
           }
      ],
      "": "15",
      "": {
      "": "so new thing",
      "mTitle": "abcdef",
      "mMessage": "ok so be it",
      "mNotificationMsg": "whatever",
      "mSeverity": "LOW",
      "mEnabled": "true"
      }
  }
  </code></pre>
  
  <p>Stackblitz link with actual functionality</p>
  
  <p><a href="https://stackblitz.com/edit/angular-mat-tooltip-x1gtcp?file=app%2Fjson-input.component.ts" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-mat-tooltip-x1gtcp?file=app%2Fjson-input.component.ts</a></p>
  
  <p>On hovering over the first column in table , a tooltip appears , on click of the button dialog box opens up which has edit json section, on click of Add As New Alert I want to check what all keys have been removed from the default json</p>