Eval and JSON file
Hi all
I always worked with XML files to collect informations to use in my scripts. Illustrator supports the XML object, so I can acess the nodes and collect the data I need from the XML.
But I recently received a JSON file. I looked into the "JavaScript Tools Guide.pdf" documentation and did not find any information about how to manipulate the JSON file like I use to do with my XML.
I asked to a friend and he told me perhaps we could use the Eval function....But I'm having no sucess. Do not know how to proceed...Initialy I tried:
var myFile = new File ("~/desktop/data.json");
alert(myFile.exists); //returns true!
myFile.open("r"); //sucess opening
var content = myFile.read(); //sucess reading
myFile.close(); //sucess closing
var x = eval(content); //CRASH!
But it did not work. It returns an error "Cannot execute script in target engine main"
How should I use eval to have an way to manipulate data in JSON?
Thank you very much
Gustavo.
