I'm writing an application in Adobes ExtendScript (older version of Javascript) where I need to parse very large json files. To do this I'm using the json2 library as there is no built-in method.
The files can often be about 10mb in size and (mostly) contains lists/dicts with tens of thousands of numbers/strings. Parsing this in Python using json.load is almost instant, but in ExtendScript it takes around 25 minutes (!).
The only way I've found to speed up this is to "eval" the code directly (no parsing) to a Javascript object. This turns the process down to something very similar to Python. Obviously it doesn't feel great to eval the code as the json files can come from different sources.
One idea I've been playing with is to let Python "validate" the content of the file before calling eval. Something like this:
Would this be considered safe? Or does this not clean the json enough to remove and security risks?