Describe the problem/error/question
I have an Edit fields node which picks an input from a kafka trigger but is interpreting this input in a quite wrong way. The input from Kafka trigger node has the following schema:
[
{
topic: string,
message: string
}
]
as in
[
{
"message": "{\"user_id\": 475, \"name\": \"Theresa Davidson\", \"phone\": \"502-890-7469\", \"address\": \"2701 Samuel Summit Suite 938\\nRyanbury, PR 78954\", \"ssn\": \"261-08-6677\", \"created_at\": \"2024-01-09 16:39:05\", \"updated_at\": \"2024-01-09 16:39:05\"}",
"topic": "users"
}
]
I want to convert the message field to a JSON object (further named payload) exactly like in the user-bets node (which is working ok) but for some reason is getting the input as the output. Initially I duplicated the user-bets to JSON node and then suspecting some parameter could be wrongly leaked I added a fresh new Edit fields node with no different result.
What is the error message (if any)?
ERROR: The ‘JSON Output’ in item 0 contains invalid JSON
{ “topic”: “users”, “payload”: {“user_id”:475,“name”:“Theresa Davidson”,“phone”:“502-890-7469”,“address”:“2701 Samuel Summit Suite 938\nRyanbury, PR 78954”,“ssn”:“261-08-6677”,“created_at”:“2024-01-09 “16”:“39”:05”,“updated_at”:“2024-01-09 “16”:“39”:05”} }; Original input: { topic: “users”, payload: {“user_id”:475,“name”:“Theresa Davidson”,“phone”:“502-890-7469”,“address”:“2701 Samuel Summit Suite 938\nRyanbury, PR 78954”,“ssn”:“261-08-6677”,“created_at”:“2024-01-09 16:39:05”,“updated_at”:“2024-01-09 16:39:05”} }
=====
Stack
NodeOperationError: The 'JSON Output' in item 0 contains invalid JSON
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Set/v2/raw.mode.js:44:15)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Set/v2/SetV2.node.js:233:57)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:696:42)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:656:68
Please share your workflow
But separating the workflows it is happening anyway ![]()
Share the output returned by the last node
Output returned by the last node (the Kafka trigger) is pinned in both trigger nodes. Expected output is:
{
“topic”: “users”,
“payload”: {
“user_id”:475,
“name”:“Theresa Davidson”,
“phone”:“502-890-7469”,
“address”:“2701 Samuel Summit Suite 938\nRyanbury, PR 78954”,
“ssn”:“261-08-6677”,
“created_at”:“2024-01-09 “16”:“39”:05”,
“updated_at”:“2024-01-09 “16”:“39”:05”
}
}
Information on your n8n setup
- n8n version: 1.20.0 (NODE_VERSION=18.18.2, YARN_VERSION=1.22.19, NODE_ENV=production, N8N_RELEASE_TYPE=stable)
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): docker-compose
- Operating system: Docker on MacOS 14
