What I am trying to do is take an array within an object within an array within an object (I know my data structure is ridiculous, any help with that would be great also) and convert the last array into an object with a "key":"value". I'm using Angular 1.5.7 if there is anything in Angular that could help do this. I know that probably makes no sense. I couldn't figure out a way to say what I am trying to do clearly so let me show you:
I start with an object like this:
{"instructor":[{"instructor_emails":[ "[email protected]","[email protected]"]}]}
And I want it to be:
{"instructor":[{"instructor_emails":{ "email":"[email protected]","email":"[email protected]"}}]}
I tried a couple of things and the closest I found was:
instructor.instructor_emails.map(function(e) {
return { email: e };
});
But it doesn't quite do what I'm trying to do... Any thoughts?
"email" : "[email protected]"
I'm just trying to manipulate it wrong..thanks for pointing that out. I should have realized it from the get go – OGJoshZero Jul 18 at 8:56