Skip to main content
aoifem79461480
Participant
June 17, 2020
Question

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

  • June 17, 2020
  • 1 reply
  • 1578 views

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 - attaching to the post), 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 & 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! 

This topic has been closed for replies.

1 reply

Mylenium
Legend
June 17, 2020

Without any extra processing AE will import the full string. You can't expect it to make any sense of your data pairs when there is no code in place to actually process the list entries. You need to tell AE that one part is the date, the other the actual value.

 

Mylenium

aoifem79461480
Participant
June 17, 2020

Hi @Mylenium - thanks for responding! I'm not sure I understand – how do I tell AE that?

 

If it helps, I was following this tutorial: https://www.youtube.com/watch?v=Wkr_XOpsAFU&feature=youtu.be&t=700 – they did not seem to have to specify the structure of the JSON at any point, so I'm a little confused.

aoifem79461480
Participant
June 17, 2020

Just wanted to post that I've figured it out – the properties in my JSON started with a number (they're dates - 01_01_20 etc) and AE didn't like it. I prefixed all of the keys with an X and it's happy again. I probably should have posted more info. Thanks anyway 🙂