Dynamic mapping of a JavaScript (JSON) Object to a HTTP `searchParams` (n8n `query`)

Describe the problem/error/question

I have an issue regarding sending to Telegram (or making HTTP request, the nodes are the same, mostly).

I need to map my searchParams object to query, but it always results in error like so…

What is the error message (if any)?

Issues:

The value "[Array: [{"name": "chat_id", "value": "-1000000000000"},{"name": "text", "value": "Some text"}]]" is not supported!

Please share your workflow

Information on your n8n setup

  • n8n version: 1.123.4 Build 5588 (patched by vsellm.ru)
  • Database (default: SQLite): I do not know, it is not managed, it is SaaS from some vendor
  • n8n EXECUTIONS_PROCESS setting (default: own, main): ???
  • Running n8n via (Docker, npm, n8n cloud, desktop app): ???
  • Operating system: ???

Hey @kenyawest Welcome to the community!

The query parameters input for http node takes a simple json object. The issue is you’re giving it an array. Perhaps try this instead:

{{ $json.toSend.searchParams }}

Sorry for late response and Happy New Year!

No it does not work, n8n still throws errors like these, even if JSON is stringified:

Finally resolved it! You must use JSON.stringify() method and must set field type to JSON. Without this, n8n will give you an error in constructor mode (not in runtime).

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.