I have an api that returns a nested object of this form:
obj: {
nestedobj1: {
name: 'a',
prop2: 'b',
prop3: 'c',
prop4: 'd'
},
nestedobj2: {
name: 'a',
prop2: 'b',
prop3: 'c',
prop4: 'd'
},
nestedobj3: {
name: null,
prop2: null,
prop3: null,
prop4: null
},
nestedobj4: {
name: null,
prop2: null,
prop3: null,
prop4: null
},
// and so on up to 15 nested objects whose internal properties are null
}
These nested objects are supposed to hold a row of table data. When the user enters the details for the fields, the inputs need to be saved in one of the nested object for which the name value is null. How do I achieve this in javascript?