on jsonlint it says: Error: Parse error on line 3: ..."n8n-instance-123" // Replace with…
- User
on jsonlint it says: Error: Parse error on line 3: ..."n8n-instance-123" // Replace with your -----------------------^ Expecting 'EOF', '}', ':', ',', ']', got 'undefined'
Assistant
Thanks for testing the JSON — and great catch!
The error:
Error: Parse error on line 3: ..."n8n-instance-123" // Replace with your -----------------------^ Expecting 'EOF', '}', ':', ',', ']', got 'undefined'🔍 What's Going On?
This is due to comments inside the JSON like:
"instanceId": "n8n-instance-123" // Replace with your actual instance ID➡️ JSON does NOT support comments, so any
//or/* */will cause a parse error.
✅ Solution: Use Valid JSON (No Comments)
Here’s the fully corrected version without any comments or invalid syntax. This should now validate correctly in JSONLint:
{ "meta": { "instanceId": "n8n-instance-123" }, "nodes": [ { "parameters": { "updates": [ { "updateKey": "message" } ] }, "id": "node1", "name": "Telegram Trigger", "type": "n8n-nodes-base.telegramTrigger", "typeVersion": 1, "position": [ 200, 300 ], "credentials": { "telegramApi": { "id": "YOUR_TELEGRAM_CREDENTIALS", "name": "YOUR_TELEGRAM_CREDENTIALS" } } }, { "parameters": { "operation": "get", "key": "={{$json[\"message\"][\"chat\"][\"id\"]}}" }, "id": "node2", "name": "Get State", "type": "n8n-nodes-base.dataStore", "typeVersion": 1, "position": [ 400, 300 ] }, { "parameters": { "property": "={{$json[\"state\"] || \"\"}}", "rules": [ { "value": "", "operation": "equal" }, { "value": "awaiting_location", "operation": "equal" }, { "value": "awaiting_job_title", "operation": "equal" }, { "value": "awaiting_gender", "operation": "equal" }, { "value": "complete", "operation": "equal" } ] }, "id": "node3", "name": "Switch State", "type": "n8n-nodes-base.switch", "typeVersion": 1, "position": [ 600, 300 ] }, { "parameters": { "operation": "sendMessage", "chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}", "text": "What location are you searching for?" }, "id": "node4", "name": "Ask Location", "type": "n8n-nodes-base.telegram", "typeVersion": 1, "position": [ 800, 100 ], "credentials": { "telegramApi": { "id": "YOUR_TELEGRAM_CREDENTIALS", "name": "YOUR_TELEGRAM_CREDENTIALS" } } }, { "parameters": { "operation": "set", "key": "={{$json[\"message\"][\"chat\"][\"id\"]}}", "value": "{\"state\":\"awaiting_location\"}" }, "id": "node5", "name": "Set Awaiting Location", "type": "n8n-nodes-base.dataStore", "typeVersion": 1, "position": [ 1000, 100 ] }, { "parameters": { "operation": "set", "key": "={{$json[\"message\"][\"chat\"][\"id\"]}}", "value": "={{JSON.stringify({state: 'awaiting_job_title', location: $json[\"message\"][\"text\"]})}}" }, "id": "node6", "name": "Set Location", "type": "n8n-nodes-base.dataStore", "typeVersion": 1, "position": [ 800, 200 ] }, { "parameters": { "operation": "sendMessage", "chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}", "text": "What job title are you looking for?" }, "id": "node7", "name": "Ask Job Title", "type": "n8n-nodes-base.telegram", "typeVersion": 1, "position": [ 1000, 200 ], "credentials": { "telegramApi": { "id": "YOUR_TELEGRAM_CREDENTIALS", "name": "YOUR_TELEGRAM_CREDENTIALS" } } }, { "parameters": { "operation": "set", "key": "={{$json[\"message\"][\"chat\"][\"id\"]}}", "value": "={{JSON.stringify({state: 'awaiting_gender', location: $json[\"location\"] || $json[\"message\"][\"text\"], job_title: $json[\"message\"][\"text\"]})}}" }, "id": "node8", "name": "Set Job Title", "type": "n8n-nodes-base.dataStore", "typeVersion": 1, "position": [ 800, 300 ] }, { "parameters": { "operation": "sendMessage", "chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}", "text": "What is the gender you are looking for? (Male/Female/Any)" }, "id": "node9", "name": "Ask Gender", "type": "n8n-nodes-base.telegram", "typeVersion": 1, "position": [ 1000, 300 ], "credentials": { "telegramApi": { "id": "YOUR_TELEGRAM_CREDENTIALS", "name": "YOUR_TELEGRAM_CREDENTIALS" } } }, { "parameters": { "operation": "set", "key": "={{$json[\"message\"][\"chat\"][\"id\"]}}", "value": "={{JSON.stringify({state: 'complete', location: $json[\"location\"], job_title: $json[\"job_title\"], gender: $json[\"message\"][\"text\"]})}}" }, "id": "node10", "name": "Set Gender & Complete", "type": "n8n-nodes-base.dataStore", "typeVersion": 1, "position": [ 800, 400 ] }, { "parameters": { "operation": "get", "key": "={{$json[\"message\"][\"chat\"][\"id\"]}}" }, "id": "node11", "name": "Get Complete State", "type": "n8n-nodes-base.dataStore", "typeVersion": 1, "position": [ 1000, 400 ] }, { "parameters": { "functionCode": "const state = JSON.parse(items[0].json.value);\nreturn [{json: {...state, chat_id: $json[\"message\"][\"chat\"][\"id\"]}}];" }, "id": "node12", "name": "Parse State", "type": "n8n-nodes-base.code", "typeVersion": 1, "position": [ 1200, 400 ] }, { "parameters": { "url": "[SCRAPING_API_ENDPOINT]", "method": "POST", "responseFormat": "json", "jsonParameters": true, "options": {}, "bodyParametersJson": "{\n \"location\": $json[\"location\"],\n \"job_title\": $json[\"job_title\"],\n \"gender\": $json[\"gender\"]\n}" }, "id": "node13", "name": "Call Scraping API", "type": "n8n-nodes-base.httpRequest", "typeVersion": 1, "position": [ 1400, 400 ] }, { "parameters": { "functionCode": "// Assume API returns { results: [ {name, title, location, gender}, ... ] }\nconst people = items[0].json.results || [];\nlet message = '';\nif (people.length === 0) {\n message = 'No matching personnel found.';\n} else {\n message = 'Here are the matching personnel:\\n\\n';\n people.forEach((person, idx) => {\n message += `${idx + 1}. Name: ${person.name}\\n Title: ${person.title}\\n Location: ${person.location}\\n Gender: ${person.gender}\\n\\n`;\n });\n}\nreturn [{json: {message, chat_id: $json[\"chat_id\"]}}];" }, "id": "node14", "name": "Format Results", "type": "n8n-nodes-base.code", "typeVersion": 1, "position": [ 1600, 400 ] }, { "parameters": { "operation": "sendMessage", "chatId": "={{$json[\"chat_id\"]}}", "text": "={{$json[\"message\"]}}" }, "id": "node15", "name": "Send Results", "type": "n8n-nodes-base.telegram", "typeVersion": 1, "position": [ 1800, 400 ], "credentials": { "telegramApi": { "id": "YOUR_TELEGRAM_CREDENTIALS", "name": "YOUR_TELEGRAM_CREDENTIALS" } } }, { "parameters": { "operation": "delete", "key": "={{$json[\"chat_id\"]}}" }, "id": "node16", "name": "Clear State", "type": "n8n-nodes-base.dataStore", "typeVersion": 1, "position": [ 2000, 400 ] } ], "connections": { "node1": { "main": [ [ { "node": "node2", "type": "main", "index": 0 } ] ] }, "node2": { "main": [ [ { "node": "node3", "type": "main", "index": 0 } ] ] }, "node3": { "main": [ [ { "node": "node4", "type": "main", "index": 0 } ], [ { "node": "node6", "type": "main", "index": 0 } ], [ { "node": "node8", "type": "main", "index": 0 } ], [ { "node": "node10", "type": "main", "index": 0 } ], [ { "node": "node11", "type": "main", "index": 0 } ] ] }, "node4": { "main": [ [ { "node": "node5", "type": "main", "index": 0 } ] ] }, "node5": { "main": [] }, "node6": { "main": [ [ { "node": "node7", "type": "main", "index": 0 } ] ] }, "node7": { "main": [] }, "node8": { "main": [ [ { "node": "node9", "type": "main", "index": 0 } ] ] }, "node9": { "main": [] }, "node10": { "main": [ [ { "node": "node11", "type": "main", "index": 0 } ] ] }, "node11": { "main": [ [ { "node": "node12", "type": "main", "index": 0 } ] ] }, "node12": { "main": [ [ { "node": "node13", "type": "main", "index": 0 } ] ] }, "node13": { "main": [ [ { "node": "node14", "type": "main", "index": 0 } ] ] }, "node14": { "main": [ [ { "node": "node15", "type": "main", "index": 0 } ] ] }, "node15": { "main": [ [ { "node": "node16", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": {}, "id": "Personnel Search Agent" }
✅ Final Steps
- Copy the entire JSON above
- Go to JSONLint
- Paste it and click Validate JSON
- If it says Valid JSON, then copy/paste into n8n and import
Let me know if you still get any issues after this! 🚀
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.