-
Parsing JSON based on layer name
Ok, so I’m playing around with AE 2018 and the new JSON import functionality, and have run into a problem.
I want to use the layer name to indicate which item from the JSON file to read. But when I try to add a variable calling the the layer name it causes an error.
My JSON file is:
[
{
“City”: “Copenhagen”,
“Year”: 2016,
“Jan”: 2,
“Feb”: 4,
“Mar”: 5,
“Apr”: 10,
“May”: 16,
“Jun”: 19,
“Jul”: 21,
“Aug”: 21,
“Sep”: 17,
“Oct”: 12,
“Nov”: 7,
“Dec”: 4
}
]The expression I have on the position is below. The problem occurs when I try to change the “monthTemp = myData.Jan” to “monthTemp = myData.month” – where it rightly so, cannot find the “month” entry in the JSON file.
How can I force the “monthTemp” to parse “month” as a variable??
Any help is appreciated.
Chris
month = thisLayer.name;
myData = footage("CPH_temps.json").sourceData[0];
monthTemp = myData.Jan;temp = linear(monthTemp, 0, 30, 992, 90);
[value[0],temp]