I have a .HTA file with JS like this:
<script>
var fso = new ActiveXObject('Scripting.FileSystemObject');
var configsHandle = fso.OpenTextFile('configs.json', 1);
var configs = configsHandle.ReadAll();
configsHandle.Close();
alert(configs);
</script>
and my configs.json
is
{"default":{"content":"main"}}
I can successfully get content of the json file as a string. But I can't convert it to JSON with JSON.stringify()
and then to parse it with JSON.parse()
because I get the error
JSON is undefined
and I don't know how to convert the string to an object / array and then to parse it at least as an associative array with
alert(configs['default']['content']);
ps. I need it to be working on Microsoft HTML Apllication host program of Win7 (i.e. not in Chrome and not in Linux or other OS)