I have the following object:
{ name: ["Jimmy","Jill"], age: [23, 42], location: { city: ["LA", "NYC"] }
For every object key there is an array value with 2 entries (always). What I'm trying to do is to recreate the object by plucking the 2nd item in the arrays. But I want this to happen recursively. So the output would be:
{ name: "Jill", age: 42, location: { city: "NYC" }
I have tried iterating through the object using Object.keys() but this doesn't appear to give me nested keys. I was wondering if there was a more elegant way to tackle this?
Many thanks in advance.
locationan array like this[{city: 'LA'}, {city: 'NY'}]? How do fields nested deeper than 1 level work?