Forums › Adobe After Effects Expressions › Parsing JSON Files – Fastest possible way?
-
Parsing JSON Files – Fastest possible way?
Tomas Bumbulevičius updated 9 months, 3 weeks ago 3 Members · 12 Posts
-
Andrei Popa
September 13, 2021 at 7:53 amHi Tomas. I think I got confused at some point with my answers. I just checked on my code and I use $.evalFile() to read the json’s. I remember doing some tests and that I used what was fastest. This is how I use it:
var alpha = $.evalFile(File("path/to/file/json.json"));
However, if you ever need to take the whole content of a file again, I suggest reading it with
var str = fileObj.read();
It reads the whole file in one go.
Here is a link with the description, page 53
JavaScript Tools Guide (macromedia.com)
I don’t think evalFile will work with the new expressions engine so maybe you will need to use the eval([string]) version if you want to use it in expressions.
-
Tomas Bumbulevičius
October 27, 2021 at 6:26 amHey Andrei, thanks for your response. I didn’t had time to focus on this recently, but few thoughts:
1. When contents of file is read as fileObj.read() – I assume its a plain binary read. Then, what to do with that readed bits, how to make them human-readable?
2. Indeed, dollar like $.evalFile is obsolete and doesn’t work if expression language set to new Javascript. While I am looking how to approach this in scripting, if someone hits that roadblock through expressions – be aware that $.evalFile in expressions works only with expression engine set to “Legacy Extendscript”. While its not a new thing, I just figured out it recently.
Log in to reply.