Parsing a string JSON object nullifies numbers that are in nested arrays.
I'm parsing a string JSON object in javascript.
The string: (throw it into https://jsonformatter.org/json-pretty-print if you want, but its pretty simple)
{"teams":[["Roman Bravo-Young (PSU)","vito Arujau (COR)"],["Spencer Lee (IOWA)","Pat GLory (PRIN)"],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null]],"results":[[[[33,0],[1,0],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null]],[[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null]],[[null,null],[null,null],[null,null],[null,null]],[[null,null],[null,null]],[[null,null],[null,null]]]]}
The code:
console.log(brackets[id].data);
var adminData = JSON.parse(brackets[id].data);
console.log("ADMIN DATA");
console.log(adminData);
The console output:
The JSON.parse is turning the [33, 0] and [1, 0] arrays into null values. I have never seen this before in my decades of programming.
Even stranger: Doing a second JSON.parse(brackets[id].data);
call will cause the FIRST call in the console to show the correct data, but the second log in the console will still show everything as null.
How can this happen? Thank you!