FORUMS: list search recent posts

Scripting - Best way to parse a large JSON file?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Will Poillion
Scripting - Best way to parse a large JSON file?
on Oct 23, 2019 at 4:08:48 pm
Last Edited By Will Poillion on Oct 23, 2019 at 4:45:17 pm

Greetings all,

I'm trying to import a fairly large JSON file to use for the creation of (mostly transform property) keyframes. The JSON file is rather simple, it's laid out like:
{
'player': 'xxx',
'video': 'xxx',
'tracking':
[
{ 'x': 99,
'y':99,
'opacity': 100,
'time': 1.532,
...
},
...
]
}

Where almost all of the data is housed in the tracking array. It contains an array containing every frame of the position of an object. I read this file in as a string, then use JSON.parse (https://github.com/douglascrockford/JSON-js) to parse it into an object.

The issue is the majority of these are going to be around 15000 frames long. The file comes out to ~ 3.3mb. It takes an average of 5-10 minutes to read in all the data, during which AE is chugging and showing the 'Not responding' as its processing the file. I know 15k is alot, but my computer is fairly fast and a simple json file with 15k array objects should still be doable.

There has to be a better way to do this. I snagged the latest copy of json2.js to see if it had been better optimized but it's still slow. I'm the one creating the json file, so I could break it up into smaller chunks, but I'd like to try improving this process first. At minimum it would be nice to do this parsing asynchronously somehow so at least it doesn't lock up the application completely while it's doing it.

I'm open to any suggestions! Thanks guys!

Will


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]