ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

JSON Data expression problem

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Javier Rodriguez
JSON Data expression problem
on Nov 9, 2018 at 6:03:10 pm

Hi,

I'm trying to start the data graph / json tutorial. The original expression to get the country name is this:

eval("var x=" + footage("csvjson.json").sourceText);
x[0].name;


The problem is that i can't get the "name" thing because in my JSON file their name goes like this:

"Country Name": "Mexico",
"Country Code": "MEX",
"Series Name": "GDP (current US$)",

If i type "Country Name" I get the expression error.

How can I get this data witout changing all the names in my file.

* Same thing with these:

"1968 [YR1968]": 29360000000,
"1969 [YR1969]": 32480000000,
"1970 [YR1970]": 35520000000,
"1971 [YR1971]": 39200000000,


Return to posts index

Scott McGee
Re: JSON Data expression problem
on Nov 12, 2018 at 12:28:24 pm

Json is funny about spaces.

I would write it like this personally.

txt = footage("Country.json").sourceData;
txt["Country Name"]


The above then allows for spaces.

Normally if you didn't have spaces in Country Name like this (Country Name), it would look like this.

txt = footage("Country.json").sourceData;
txt.CountryName


Hopefully that helps


Return to posts index

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