title: JSON.parse returns children objects with null value, children values not being parsed
body: <p>I have a JavaScript object that I am stringifying with JSON.stringify that returns a JSON string with parent and children data.</p>
  
  <p>When I try to parse this string back to an object, the children objects are now null.</p>
  
  <pre><code>function cacheForm(agency) {
  
   var agency = ko.toJS(this); //easy way to get a clean copy
   delete agency.contacts; //remove an extra property
  
          for (i in agency.offices) {
              for (val in agency.offices[i]) {
                  //delete agency.offices[i].agency;
                  //delete agency.offices[i].agencyID;
              }
          }
  
              for (i in agency.offices) {
                  for (ii in agency.offices[i].contacts) {
                      for (val in agency.offices[i].contacts[ii]) {
                          //delete agency.offices[i].contacts[ii].office;
                          //delete agency.offices[i].contacts[ii].agencyID;
                          //delete agency.offices[i].contacts[ii].officeID;
                      }
                  }
              }
  
                   var value = agency;
  
                   var cache = [];
                   parsed = JSON.stringify(value, function (key, value) {
                       if (typeof value === 'object' &amp;&amp; value !== null) {
                           if (cache.indexOf(value) !== -1) {
                               // Circular reference found, discard key
                               return;
                           }
                           // Store value in our collection
                           cache.push(value); 
                       }
  
                       return value;
                   });
  
  
                   var data = JSON.parse(parsed);
      }
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>Agency part of my view model that I am passing into my cacheForm function and I am using </p>
  
  <pre><code> var agency = ko.toJS(this); 
  </code></pre>
  
  <p>to have my data available in an object which can be parsed to JSON string. I may of deleted this code in my post because my original code had many annotations.</p>
  
  <p><img src="https://i.stack.imgur.com/mHpZD.png" alt="My agency object before stringify - it has child data"></p>