I have a php script that returns on array as JSON. I then eval the JSON to make it into an object which I then want to use.
The problem here is that my sever is sending an array that has id’s in it, which makes the name of the javascript objects numbers, which when trying to print, it does not seem to work.
So, using the following:
[CODE]var json = ‘{“43”:{“48”:{“id”:”48″}}}’;
json = eval(‘(‘ + json + ‘)’);
document.write(json.43.48.id);
Firebug tells me:
[CODE]missing ) after argument list
So, is it just not possible to have numbers as names in an object? Not really sure how I could change this, as my server sends it this way…guess I could try to tweak the array before it gets sent if this needs to be done.
Ideas?