Example output from PHP:
{
"RootName_0":{"Id":1,"ValId":1,"Value":"Colour","Text":"Blue"},
"RootName_1":{"Id":1,"ValId":2,"Value":"Colour","Text":"Red"}
}
How can I use Backbone.js or jQuery to only have:
[
{"Id":1,"ValId":1,"Value":"Colour","Text":"Blue"},
{"Id":1,"ValId":2,"Value":"Colour","Text":"Red"}
]
If it’s easier to use PHP to edit the JSON, then so be it.
Well, in PHP it would be easy, just use
array_values()on the initial array so that it ‘forgets’ the array indexes (which by the way, is what ‘RootName_X’ is called in your case:In javascript, it’s a bit trickier, but it would be on the lines of:
The question title
iswas a bit confusing since these are certainly not tags.