I have a JSON associate array
[{"Test":"5:00pm"},{"Testing2":"4:30 pm"}]
and I want to make it so that it becomes an array where
{
theatre = Test
time = 5:00pm
},
{
theatre = Testing2
time = 4:30 pm
}
But I can’t figure out how to take a key name and make it a value…
Any help? I was looking at Object.keys but I couldn’t find a suitable solution.
You have an array with object values. You’d need to loop over them:
http://jsfiddle.net/FNAtw/
This will give you an array stored in
newArraywith two elements. The first element is an object with kvpstheatre: 'Test'andtime: '5:00pm'. The second element is an object with kvpstheatre: 'Testing2'andtime: '4:30pm'.