I’m retreiving a JSON string and parsing it with jQuery with $.getJSON.
After I get the data in a variable, can I add or remove rows? An example:
{
"one": [{
"sid": "1",
"name": "NAME 1"
}, {
"sid": "2",
"name": "NAME 2"
}],
"two": [{
"sid": "3",
"name": "NAME 3"
}]
}
Can I delete sid 1 from “one” and place it in “two”? How about sorting by sid? I’m using jQuery.
sure, you can do any of that, they are regular objects and arrays. You can sort arrays, remove their members, add members to other arrays, etc. I wouldn’t use jquery stuff, just use basic array tools, such as splice and push and pop. splice() can do most anything: http://www.w3schools.com/jsref/jsref_splice.asp
Sorting is easy as well, just use sort() on the arrray.