'Respond to Webhook' note doesn't use JSON settings

Information on your n8n setup

  • n8n version: 1.37.3
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Ubuntu 22.04 LTS

It’s set to ‘respond with JSON’ and ‘Response Body’

{
“result”: “{{ $json.response.text }}”
}

but the resulting JSON looks like this:

[
{
“response”: {
“text”: “We handle all aspects of property management, including leasing, maintenance, financial management, and tenant relations.”
}
}
]

screenshot: Image 2024-04-24 at 10.07.5...

So what am I missing here please?

Hi @ONC

Can you share your workflow and what exactly you are trying to achieve?
I am afraid I cannot quite follow what you are asking :thinking:

Thanks!

well, input comes into this node in this format:

{"response": {"text": "We handle all aspects.}}

We want the node to transform it into this format:

{"result": "We handle all aspects."}

And for that we’ve set the node to ‘respond with JSON’ and ‘Response Body’ to this:

{"result": "{{ $json.response.text }}"}

However, that doesn’t seem to have ANY effect, as the output is still unchanged, which is this:

{"response": {"text": "We handle all aspects.}}

As you can see from this screenshot: Image 2024-04-24 at 10.07.5...
Weirdly enough, the expected result shows up on this screenshot, however not as output but as preview below the ‘Response Body’ box.

Now, what needs to be changed to make this work as intended please?

As requested, here is the copied node:

  "meta": {
    "instanceId": "xxxxx"
  },
  "nodes": [
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"result\": \"{{ $json.response.text }}\"\n}",
        "options": {
          "responseCode": 200
        }
      },
      "id": "yyyy",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1180,
        340
      ]
    }
  ],
  "connections": {},
  "pinData": {}
}

Ok I gotya now! Thanks for that additional clarification.

Just wondering, in your preview Webhook node have you set the Respond parameter to Using 'Respond to Webhook' Node as shown below?

yes

maybe just focus on this MISMATCH that I don’t understand:

Is the json being returned the JSON from the previous node?

I had this same issue one day and i spoke to some others about it and they couldn’t reproduce. The next day it was working as expected again.

Try rebooting your instance and see if that works.

yes, OUTPUT is exactly the same as the INPUT.

We’ve restarted our n8n server a few times (for other reasons) but the above outcome has stayed the same unfortunately.

How long has this been ongoing?

I tried to recreate but couldn’t on 1.36.1
Can you please embed your workflow like this so i can try it out on my account?

Workaround:

I do know the best work around though. Add an edit fields node right before the respond to webhook node and make sure Include Other Input Fields is disabled.
Then put your desired output there and it will work

great workaround, thanks a lot!

1 Like

So, this seems to be an UI mismatch only.
Having tested this in Postman I get the correct response to client:

image

So basically, the node is doing what it’s supposed to do, just not displaying it…
Will bring this up on our side…

Thanks for your patience and investigative spirit! :slight_smile:

1 Like

I just noticed your using an npm install.

I just tried on my local dev npm version and switched to 1.37.3 and couldn’t reproduce.

Have you tried making it in a new workflow?

Copy this workflow in a new workflow and let me know if it is working

(test on canvas and go to webhook url in browser)

Were you able to reproduce the issue? Can you share steps to if you did?

Edit: Actually I was just missing that it is infact showing the wrong data on the UI but the correct data on the request.


When i had this issue it definitely was effecting in postman as that’s what I use to test. Also effected the browser when testing get requests, but that seemed to fix itself so i don’t know what that was

that’s great news then, thanks a lot Ria for that, highly appreciated! Great idea to inspect the final result with Postman, mental note taken! :wink:

1 Like

yep I guess your and Ria’s msgs just crossed.

So I took your test workflow, and there I can reproduce the (display) issue: the actual return value is

{"worked":true}

but on the node it shows as false:

So I guess that confirms the (display) bug. But it’s good news that the actual output is correct :slight_smile:

2 Likes

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