I need to restructure my data so that it fits in with another piece of code. I need to convert my data (which is a name,value pair) into the following structure so that that it is processed correctly. Using JQuery how would I do so?
{items: [
{value: "21", name: "Mick Jagger"},
{value: "43", name: "Johnny Storm"},
{value: "46", name: "Richard Hatch"},
{value: "54", name: "Kelly Slater"},
{value: "55", name: "Rudy Hamilton"},
{value: "79", name: "Michael Jordan"}
]};
Right now I've got a $.each loop which is feeding each name,value pair in but I don't know how I'd get that exact structure.