title: How to find and update specific value in nested object array in typescript
body: <p>I have a nested object array with n level like this:</p>
  <pre><code>const data = {
      &quot;id&quot;: null,
      &quot;label&quot;: &quot;Locations&quot;,
      &quot;value&quot;: &quot;Locations&quot;,
      &quot;expanded&quot;: true,
      &quot;children&quot;: [
          {
              &quot;id&quot;: &quot;A978919C-E99C-EB11-8F2E-A01D48E35246&quot;,
              &quot;value&quot;: &quot;Tokyo &quot;,
              &quot;label&quot;: &quot;Tokyo &quot;,
              &quot;checked&quot;: true,
              &quot;children&quot;: [
                  {
                      &quot;id&quot;: &quot;88887069-179A-EB11-9C25-00163EDCFF95&quot;,
                      &quot;isDefault&quot;: true,
                      &quot;locationId&quot;: &quot;A978919C-E99C-EB11-8F2E-A01D48E35246&quot;,
                      &quot;parentsId&quot;: null,
                      &quot;createDate&quot;: &quot;2021-06-20T19:03:55.190Z&quot;,
                      &quot;updateDate&quot;: &quot;2021-10-16T13:36:41.353Z&quot;,
                      &quot;label&quot;: &quot;RAJ - Automotive Japan Fa Fusoh&quot;,
                      &quot;checked&quot;: true,
                      &quot;children&quot;: [],
                      &quot;disabled&quot;: false
                  }
              ]
          },
         
  .
  .
  
      ]
  }
  </code></pre>
  <p>I have an object</p>
  <pre><code>{
      &quot;id&quot;: &quot;A978919C-E99C-EB11-8F2E-A01D48E35246&quot;,
      &quot;value&quot;: &quot;Tokyo &quot;,
      &quot;label&quot;: &quot;Tokyo &quot;,
      &quot;checked&quot;: false,
      &quot;_depth&quot;: 1,
      &quot;_id&quot;: &quot;A978919C-E99C-EB11-8F2E-A01D48E35246&quot;,
      &quot;_parent&quot;: &quot;rdts1-0&quot;,
      &quot;_children&quot;: [
          &quot;88887069-179A-EB11-9C25-00163EDCFF95&quot;
      ],
      &quot;_focused&quot;: true
  }
  </code></pre>
  <p>and I want to edit <code>checked</code> in the object array by using the IDs in the last object and its children, change each <code>checked</code> in object in the object array to <code>false</code>
  I used DFS for the children but I didn't get a good result any help please.</p>