Help

Issue parsing JSON from Input value

Topic Labels: API Scripting
Solved
Jump to Solution
2281 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_Jakarta
7 - App Architect
7 - App Architect

Hi,

I've been trying to learn and build a script with the help of ChatGPT. The script creates a report in Clockify and all works fine until I replace the value input variable from a fixed value to a feiled in the base from a previous step. 

The value is just a string but is actually a lookup from another table. I've tried to use a formula in another field and use that but both result in the error seen in the screen shot.

I feel like I'm so close, any advise ?JSON Error.png  

1 Solution

Accepted Solutions
Jack_Manuel
7 - App Architect
7 - App Architect

Looks like you don't need the [] around projectId in your projects filter as it's already an array. Also, not necessary, but if that is the case I would update that variable to be called projectIds as it might help you keep track.

To clarify;

 

//an array of strings with length 1
const projectId = ['abcdefg'];

console.log(projectId);
//returns ['abcdefg']

console.log([projectId]);
returns [['abdcedfg']]

 

See Solution in Thread

2 Replies 2
Jack_Manuel
7 - App Architect
7 - App Architect

Looks like you don't need the [] around projectId in your projects filter as it's already an array. Also, not necessary, but if that is the case I would update that variable to be called projectIds as it might help you keep track.

To clarify;

 

//an array of strings with length 1
const projectId = ['abcdefg'];

console.log(projectId);
//returns ['abcdefg']

console.log([projectId]);
returns [['abdcedfg']]

 

Nice one Jack. Exactly right. Thanks for your help and explanation