Function: setNestedProperty()
function setNestedProperty(
   obj, 
   field, 
   value): void;
Sets or deletes a nested property in an object using PHP-style bracket notation. If value is null or undefined, deletes the property and cleans up empty parents.
Parameters
| Parameter | Type | Description | 
|---|---|---|
obj | any | The object to modify. | 
field | string | The field path in PHP-style bracket notation (e.g. 'a[b][c]'). | 
value | any | The value to set. If null or undefined, the property is deleted. | 
Returns
void
Example
setNestedProperty(obj, 'a[b][c]', 123) // obj.a.b.c = 123
setNestedProperty(obj, 'a[b][c]', null) // deletes obj.a.b.c