This should be a very simple issue, but I’ve been racking my brain on this for much too long. Below is the latest iteration of the function. I either get an error that the return type is not correct or I get “[object Object]” in my json.
Simple, input a string of text. Separate that text into an array of strings. Return the array.
Current implementation
const text = String($input.first());
const lines = text.split("\n");
return [{json: {output: JSON.parse(JSON.stringify(lines))} }];
Input
[
{
"text": "Line #1\nLine #2\nLine #3"
}
]
Output returned by the last node
[
{
"output": [
"[object Object]"
]
}
]
Expected Output
[
{
output: [
"Line #1",
"Line #2",
"Line #3"
]
}
]
Information on your n8n setup
- 1.91.3:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: Windows 11