I've been scratching my head for the last couple of hours trying to get a JSON object into my script.
I've been following this tutorial and several others and I've got the code below:
// Testing data get #include "~/Desktop/test/json2.js" var myFile = new File ("~/Desktop/test/testData.json"); if (myFile.open("r")){ myFile.encoding = "UTF-8"; var myJson = myFile.read(); var myObject = JSON.parse(myJson); myFile.close(); } myObject.email;
However, every time I run this it opens up a new javascript file (starting with ADOBE CONFIDENTIAL) highlighting 'throw SyntaxError()' on line 1364.
// Internal: Resets the parser state and throws a `SyntaxError`. var abort = function () { Index = Source = null; throw SyntaxError(); };
I'm testing using AE 2017.2 and ExtendScript V4. If anyone could point me in the right direction that would be great.
EDIT: Instead of using '#include', I also tried minifying and including the json2 code but still no luck.