-
How do you look up line numbers in a JSON file?
Hey Everyone,
I’m new here and I am trying something different in After Effects. I’ve found several helpful threads here but I still can’t seem to solve this problem.
I have a JSON file with a list of Teams, Mascots, and Logos. I want to type in a team name in one layer and have another text layer autofill with the mascot. basically I need to be able to find the line number of the matching Team so that I can output the corresponding Mascot.
I’ve been trying to adapt this thread here: https://forums.creativecow.net/docs/forums/post.php?forumid=227&postid=40261&univpostid=40261&pview=t
but to be honest I really don’t know what I’m doing (As you can probably tell from my code ☺ ). Any feedback or tips would be greatly appreciated!Thanks!
Austin
json=eval(footage("TeamInfo.json").sourceText);lookup={};
for (i in json) {
line=json[i];
LineNumber = line.TeamName;
lookup[LineNumber] = {TEAM: line.team, MASCOT: line.mascot, LOGO: line.logo};
}// get the Team Name
TeamName=thisComp.layer("Team").text.sourceText;LineNumber = TeamName;
lookup[LineNumber].mascot;