How can I update a nested object in JavaScript and Typescript?

I have a data object that I want to update the values inside, but it can be a value inside a nested object. But its exact location is not known.
I put it’s parents’ names inside each one. A form is created from this object and I need to be able to change the values inside the object by entering the values in the form.

obj['key2']['key3']['childern'][key4].value = 'anyting'

I don’t know how nested this object can be.

object sample:

 obj = {
   key1:{
           type='parent',
           name='parent1',
           ...
           childern:[
              key2:{
               type='any',
               value='',
               parents = ['key1']
            },
             key3:{
               type='parent',
               value='',
               parents = ['key1'],
           childern:[
              key4:{
               type='any',
               value='',
               parents = ['key1','key3']
            }]
            },

           ]


        }
}