title: How can I save changes in a deep nested object?
body: <p>I have the next data:</p>
  
  <pre><code>reservations = {
  "2016":{"A36822":{"datetime":"6/22/17 at 11:00AM","visitors":"11 guests", "notes_backend":"Some notes 111"}},
  "2017":{"A36822":{"datetime":"6/22/17 at 11:00AM","visitors":"11 guests", "notes_backend":"Some notes 222"}}
  }
  </code></pre>
  
  <p>I need to change some <code>notes_backend</code> and then send updated <code>reservations</code> to API.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var reservations_obj = JSON.parse(reservations),
      raw_id = 'A36822';
  
  for (var year in reservations_obj){
      if (raw_id in reservations_obj[year]){
          reservations_obj[year][raw_id]["notes_backend"] = "UPDATED NOTES";
          console.log('new_data:', reservations_obj[year][raw_id]); // new_data: {datetime: "6/22/17 at 11:00AM", visitors: "11 guests", notes_backend: "UPDATED NOTES"}
          console.log(JSON.stringify(reservations_obj)); // no changes
          break;
      }
  }
  
  ... send updated reservations_obj to API
  </code></pre>
  
  <p>The first <code>console.log</code> shows that <code>reservations_obj[year][raw_id]</code> is changed, but the second <code>console.log</code> shows me initial <code>reservations_obj</code> without any updates.</p>
  
  <p>The code above is based on Python logic, but how to implement it in JavaScript?</p>