I have a set of data that is being passed on by the PHP\'s json_encode
function. I\'m using the jQuery getJSON
function to decode it:
It looks as though it's not an array but an arbitrary object. If you have control over the PHP serialization, you might be able to change that.
As raina77ow pointed out, one way to do this in PHP would be by replacing something like this:
json_encode($something)
with something like:
json_encode(array_values($something))
But don't ignore the other answers here about Object.keys
. They should also accomplish what you want if you don't have the ability or the desire to change the serialization of your object.