ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

AE unable to read data from an external JSON file using .sourceData

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
aoife mccarthy
AE unable to read data from an external JSON file using .sourceData
on Jun 17, 2020 at 2:24:12 pm

Hi all - I'm trying to create a data-driven animation in AE, but am having issues using the .sourceData attribute to read the data from my JSON file (the very first step, argh!).

I'm trying to use values from the JSON to set the size property of an ellipse path.

When I start my expression off with this line:

myData = footage("impact_scores.json").sourceData;

I get this error message:



I can't see that there's anything wrong with my JSON (it's just a simple array of objects - 14186_impactscores.json.zip), and I can't seem to find anybody online having the same issue.

Has anybody experienced this problem before or have any ideas on how to troubleshoot? I've tried both expressions engines (javascript and legacy - with legacy the error message is 'Object of type Object found where a Number, Array, or Property is needed'), and I've tested a bunch of different JSONs with the same result.

Here's the expression I want to write once I can get the JSON to link:

myData = footage("impact_scores.json").sourceData;

val = myData[1].01_01_2020

[val,val]


...and I've just updated my AE, so am running version 17.1.1.

Any help would be greatly appreciated!


Return to posts index

Dan Ebberts
Re: AE unable to read data from an external JSON file using .sourceData
on Jun 17, 2020 at 5:26:04 pm

I can get your expression to work with your data file, but I have to change the names of data fields so that they start with a letter. For example:

"01_01_2020": 0,

doesn't work, but

"X01_01_2020": 0,

does.

Dan



Return to posts index

aoife mccarthy
Re: AE unable to read data from an external JSON file using .sourceData
on Jun 17, 2020 at 7:20:41 pm

Hi Dan, thank you so much – problem solved! Funnily enough my developer friend had suggested this to me earlier, but I must have made some other error whilst I was trying it out the first time as it didn't work.

Thanks again!


Return to posts index

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