[Solved] How to transform subobject into a string [closed]

let dt = { “cars” : [ { “id”: 0, “color”: “blue” }, { “id”: 3, “color”: “-” }, { “id”: 0, “color”: { “id”: 0, “color”: “yellow” } } ] }; dt.cars = dt.cars.map(it=> { it.color = typeof it.color == “string” ? it.color : it.color.color; return it; } ) console.log(dt); solved How to transform … Read more