Untitled
unknown
javascript
a year ago
323 B
0
Indexable
Never
let inputArrayObj = [ // your input array objects here ]; let outputJsonArray = []; for (let i = 0; i < inputArrayObj.length; i++) { outputJsonArray.push(inputArrayObj[i]); if (inputArrayObj[i].relative === true) { outputJsonArray.push(inputArrayObj[i].relativeTypeDetails); } } console.log(outputJsonArray);