How to access deeply nested data from Webhook POST payload

Describe the problem/error/question

Deeply nested data posted to my webhook are not accesible.

I have the following data that I’m posting to my webhook endpoint:

response = requests.post(
    "https://n8n.mycustomdomain.com/webhook-test/6cb5cdp8-2e82-444f-b6e6-e7e4f0023ba3",
    data={
        "foo": 1,
        "bar": {
            "baz": [1,2,3],
            "quz": "SOMETHING",
            "quonk": {"a": 2}
        }
    }
)

However, when I see the data on the webhook, the data look like this:

I am quite new to n8n and I understand that the payload needs to conform to a particular data structure, but how do I then access the values I need?

I thought that using a code node would allow me to access those values, but I’m not sure if I’m referencing the correct variable:

What is the error message (if any)?

No error message per-se, but I cannot access the data that I need from the payload

Information on your n8n setup

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

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hi @n8b

Thanks for posting here and welcome to the community! :raised_hands:

You’re using Python’s request library, which tends to flatten JSON data.
Try using the json parameter instead.

1 Like

:see_no_evil: :sweat_smile:

Thanks @ria that solved it!

1 Like

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