Skip to main content
granth54436419
Known Participant
March 3, 2022
Answered

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

  • March 3, 2022
  • 2 replies
  • 972 views

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)

This topic has been closed for replies.
Correct answer antoinelp

Hi,

I've just had the same issue.

To solve it, I duplicated my json file, changed it's name, and it's working again...

Cheers

2 replies

antoinelpCorrect answer
Participant
August 8, 2024

Hi,

I've just had the same issue.

To solve it, I duplicated my json file, changed it's name, and it's working again...

Cheers

granth54436419
Known Participant
March 3, 2022

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.

granth54436419
Known Participant
March 11, 2022

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