I'm trying to turn this object into an array of objects, with the object key being placed into a property of each of the objects in the array.
Here is the input:
var input = {
"2017-03-13": ["Event 1", "Event 2"],
"2017-03-14": ["Event 1", "Event 2"],
"2017-03-15": ["Event 1", "Event 2"]
}
And here is my desired output:
[
{
date: "2017-03-13",
events: ["Event 1", "Event 2"]
},
{
date: "2017-03-14",
events: ["Event 1", "Event 2"]
},
{
date: "2017-03-15",
events: ["Event 1", "Event 2"]
}
]
Any thoughts on how I might approach this? I have underscore.js at my disposal as well.