Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Scripting – Best way to parse a large JSON file?

  • Scripting – Best way to parse a large JSON file?

  • Will Poillion

    October 23, 2019 at 4:08 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

Viewing 1 of 1 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy