I'm working with a .hta document at the moment, and attempting to import and read from a local JSON file. I've already successfully loaded the file in, and just need to call JSON.parse
to turn it into an object. However, even though I have IE11, HTA uses an older Internet Explorer without json2. Even after importing the json2 from the official github in a script tag, I still get an error that JSON is undefined.
I have tried moving my JavaScript to below the body to see if it affects loading times, but that didn't seem to help. I also tried removing and adding the type attribute to the script tag.
var data = '{"name": "Test"}';
var formatted_data = JSON.parse(data);
alert(formatted_data.name);
I expected to get an alert with "Test" as the only text, but instead I get an Internet Explorer dialog reading 'JSON' is undefined.
I'm really stumped on this one; usually I can find a simple solution to issues such as this but not in this case.