DESPERATE: how to load external JSON data?
Posted: January 29th, 2007, 7:32 am
OK,
So I'm trying to hack the FCP to AE workflow that Dale Bradshaw blogged about...
I've got my Final Cut XML parsed in to JSON using some PHP functions from IBM's developer pages...I just parsed the entire file rather than trying to create routines for specific elements. I figure I'll take the elements I want once I'm working with it as a Javascript Object.
Now I just need to get AE to load and evaluate the output file.
Can anyone tell me what command is necessary to load a JSON object in to AE from an external text file?
My JSON file is called "jsonOutput.js" (the naming can easily be changed) and it's at the root level of my drive, and it is of course a large data object starting with a curly bracket and going in to a long series of nested objects and arrays within it.
It starts like this: "{"xmeml":{"@attributes":{"version":"1"},"sequence":..."
..and goes on for pages.
I tried this for instance:
var jsonFile = new File("/jsonOutput.js");
jsonFile.open("r");
var jsonData = eval( jsonFile.read() );
jsonFile.close();
alert(jsonData.xmeml.sequence.name);
...which didn't give me an error at first, until I added that last line to see if I could actually get some data from it. So obviously this is wrong -- it's probably not actually reading the file at all. I'm sure I don't have the right method here and I trying to search the stupid Scripting Guide PDF for words like "load" and "file" is just ridiculous. Any ideas?
Everywhere I look for info about JSON it says you should be able to just do eval() on the file, but that is for Javascript in HTML pages and in this case I don't know what the equivalent is...
Please help!! I would really like to get this thing working!!
So I'm trying to hack the FCP to AE workflow that Dale Bradshaw blogged about...
I've got my Final Cut XML parsed in to JSON using some PHP functions from IBM's developer pages...I just parsed the entire file rather than trying to create routines for specific elements. I figure I'll take the elements I want once I'm working with it as a Javascript Object.
Now I just need to get AE to load and evaluate the output file.
Can anyone tell me what command is necessary to load a JSON object in to AE from an external text file?
My JSON file is called "jsonOutput.js" (the naming can easily be changed) and it's at the root level of my drive, and it is of course a large data object starting with a curly bracket and going in to a long series of nested objects and arrays within it.
It starts like this: "{"xmeml":{"@attributes":{"version":"1"},"sequence":..."
..and goes on for pages.
I tried this for instance:
var jsonFile = new File("/jsonOutput.js");
jsonFile.open("r");
var jsonData = eval( jsonFile.read() );
jsonFile.close();
alert(jsonData.xmeml.sequence.name);
...which didn't give me an error at first, until I added that last line to see if I could actually get some data from it. So obviously this is wrong -- it's probably not actually reading the file at all. I'm sure I don't have the right method here and I trying to search the stupid Scripting Guide PDF for words like "load" and "file" is just ridiculous. Any ideas?
Everywhere I look for info about JSON it says you should be able to just do eval() on the file, but that is for Javascript in HTML pages and in this case I don't know what the equivalent is...
Please help!! I would really like to get this thing working!!