I would like to know how i can split this using jquery…
"{"answer":["q1001-a2","q1002-a2","q1003-a2","q1004-a2","q1005-a2","q1006-a2"]}"
So i can then make the following JSON…
{
"d": [
{
"question": 1001,
"answer": "a2"
},
{
"question": 1002,
"answer": "a2"
}
]
}
Thanks.
Loop the
answer, split the element by-, create the new element and then push it tod.The live DEMO.