Hi,
I am new to n8n. Learning now. I am trying to import attached json, but giving error:
(element ?? []).forEach is not a function
Attached my json code. please help to fix. I am using n8n cloud. thanks,
"parameters": {
"functionCode": "const defects = $json.rows || [];\nlet latexContent = `\\documentclass{article}\\usepackage[utf8]{inputenc}\\usepackage{graphicx}\\usepackage{geometry}\\geometry{a4paper, margin=1in}\\begin{document}\\title{Defect Report for ${$json.rows[0].imageName}}\\date{${$json.rows[0].date}}\\maketitle\\section{Defect Details}\\begin{itemize}`;\ndefects.forEach(defect => {latexContent += `\\item Type: ${defect.defectType}, Size: ${defect.defectSize}px, Location: (${defect.xCoord}, ${defect.yCoord})`;});latexContent += `\\end{itemize}\\section{Image}\\includegraphics[width=\\textwidth]{image.jpg}\\end{document}`;\nreturn { latex: latexContent, imageData: $json.imageData };"
}
Hey @Parthib1967 hope all is well. Welcome to the community.
How are you trying to import the attached json?
Is this what you are looking for?
Hi Jabbson, yes, some more nodes are there. shall i share full json file to you?.
I still don’t understand what you are looking for or what you are looking for help with
When I import below json in my n8n cloud, I am getting error:
full json file attached:
error is below:
(element ?? []).forEach is not a function
I create new workflow, then choose import from flie , and upload above json, getting that error. hope it is clear now 
Where did you get this JSON?
I am not surprised. If you tell grok you cannot import the json and the error - can it find the problem?
no, it did gave me the solution , but did not work. generated by Grok. Actually I am senior manager - data science and AI. Found n8n 2 days ago, So I wrote a prompt to generate this json as i want to build quick prototype and show it to end users. all my developers are busy. Hence, I seek help from this forum 
You would literally spend less time manually constructing this workflow in n8n compared to interrogating Grok and then dealing with the hallucinated workflow.
I fully agree with you. But I do not have time. This is just starting point. I have more enhancement need to be done. This is for enterprise use case. I am show case the n8n capabilities to top management. Do you have any resources who can help build this workflow?. we can pay for that.
If the workflow you are looking to build is something relatively simple - you can explain what you need to build here on forum and maybe someone will pick it up and build for you.
sure. thank you. i will create new topic.
Hi Jabbson, Claude helped me to fix the code issue. I am able to import now. thank you. If i need help in configuring these nodes , I will raise the question here. thank you so much.
1 Like
im trying to upload a json… but since yestarday with error… already asked perplexity and chat gpt ho fix.. but n8n didnt accept… i dont know what to do