I have been trying to read the values of a simple JSON array I wrote in Java, in Javascript. None of my experiments have seemed to work, though. I've tried accessing these values as suggested by seemingly "duplicate" Stack Overflow posts. Link1 Link2 Link3 Link4
JSON
{"Year":["2023","2027","2031","2035","2039","2043","2047","2051","2055","2059","2063","2067"],"CO2":[417.06933333333336,423.9074666666667,430.7456000000001,437.5837333333334,444.42186666666674,451.2600000000001,458.0981333333334,464.93626666666677,471.77440000000007,478.61253333333343,485.4506666666668,492.2888000000001]}
JAVASCRIPT
<script type="text/javascript">
var json = JSON.parse("FutureAtCurrentRate.json");
alert(json[0].Year);
alert(json[0].CO2);
alert(json["Year"][0]);
alert(json["CO2"][0]);
alert(json[0]["Year"]);
alert(json[0]["CO2"]);
alert(json.Year);
alert(json.CO2);
</script>
So, I have all these alerts in the script, yet no alert box shows when I run it on a HTML page. The json file is saved in the same folder directory as the .jsp file.