I want to read data from a Google spreadsheet and send it to my CRM via API.
Here is my workflow:
When I poll data from Google, I am receiving the data with brackets:
How can I remove these brackets? I am getting a JSON error on the last node because of those brackets I think.
Information on your n8n setup
- n8n version:
- Database you’re using (default: SQLite):
- Running n8n with the execution process [own(default), main]:
- Running n8n via [Docker, npm, n8n.cloud, desktop app]:
Hi @fxholl, n8n items are an array of 0 or more JSON objects, and these square brackets are how arrays are represented in JSON notation.
When using the HTTP Request node, n8n will only send a single item in each request, not the whole array. So, there should be no square brackets surrounding your item.
The problem in your case will most likely be that n8n nodes are rather picky as to what data format exactly they accept. For some nodes, a string representation is expected, for other nodes an actual JSON object is required. This is unfortunately inconsistent, so when in doubt you might need to try both (for the HTTP Request node a string is required, but it would still need to represent a valid JSON structure). In addition, line breaks can interrupt expressions.
So, in this specific case you want to use a stringified JSON object and no line breaks. For example like so:
This request would arrive on the receiving server like so:
Hope this helps!