JSFiddle - React, Tailwind, and code Playground
by Mark
JavaScript
var employeesWithComplexLocation =
[{"name":"jon","location":{"country":"usa","city":"austin"}},
{"name":"jane","location":{"country":"usa","city":"houston"}},
{"name":"mary","location":{"country":"usa","city":"dallas"}}
];
var emps = employeesWithComplexLocation.map(e =>
{
//alert(e.name + " : " + e.location.city);
return { name: e.name, location: e.location.city }
}
);
console.log(emps);