Looking for solution to error "type error: cannot read property 0 of null".

Explorer ,
Mar 03, 2022 Mar 03, 2022

Copy link to clipboard

Copied

I am getting the error "type error: cannot read property 0 of null" in the following expression (for Source Text property):

eval("var dateRange="+footage("WK_2022-2.json").sourceText);
dateRange[5,0].D1;

I am getting the same error (for "property 1") with this code: 

eval("var wkUser="+footage("WK_2022-2.json").sourceText);
user=wkUser[0,1].D1;
min=0;
max=2500;

max_movement=-800;
newBaseline=874;

myYheight=((user-min)/max)*max_movement+newBaseline;

[value[0],myYheight]

It appears that AE is not recognizing the JSON file.
The file WK_2022-2.json exists; it and the project file are in the same folder. The JSON file is in the project.
I've attached the JSON file for reference.
What's really frustrating is that I've had it working, and then it stops.
Version: AE 22.2.0 (Build 120)

TOPICS
Error or problem , Expressions

Views

45

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 03, 2022 Mar 03, 2022

Copy link to clipboard

Copied

OK.. walked though things with one of our developers, and he created the attached file, which works.

THE ONLY DIFFERENCES are:

  • The file name is WK_2022_2.json (underscore rather than hyphen). 
  • The elements ("D1": 842, etc.) are indented by 6 spaces, rather than 4. (the framing braces are also indented an additional 2 spaces as well (4 rather than 2).

Both are UTF-8, and the lines end with a LF.
Putting this here to help others, and in the hope that someone will explain why the extra two spaces are the solution.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

LATEST

Realized that I had not attached the second (working) file. Attaching it here.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines