I have a Json file like this
{
"0":{
"poperty1":"poperty1",
"poperty2":"poperty2",
},
"1":{
"poperty1":"poperty1",
"poperty2":"poperty2",
},
"2":{
"poperty1":"poperty1",
"poperty2":"poperty2",
},
}
And i read it with this function:
function readJson(){
var rawFile = new XMLHttpRequest();
rawFile.open("GET", "file.json", false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status === 0)
{
// console.log(JSON.parse(rawFile.responseText));
}
}
};
rawFile.send(null);
return JSON.parse(rawFile.responseText);
}
But it return every value exept the 0
"1":{
"poperty1":"poperty1",
"poperty2":"poperty2",
},
"2":{
"poperty1":"poperty1",
"poperty2":"poperty2",
}
even if i removit and start the json with 1 it return the 1 as well.
so any idea why?