# HTTP Request Node JSON Error

**URL:** <https://community.n8n.io/t/http-request-node-json-error/72121>\
**Category:** Questions\
**Tags:** data-transformation, http-request\
**Created:** [January 22, 2025, 9:26pm UTC](https://community.n8n.io/t/http-request-node-json-error/72121 "2025-01-22T21:26:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Logan\_Spencer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/logan_spencer/32/46934_2.png) [@Logan\_Spencer](https://community.n8n.io/u/Logan_Spencer)\
**Post date:** [January 22, 2025, 9:26pm UTC](https://community.n8n.io/t/http-request-node-json-error/72121/1 "2025-01-22T21:26:47Z")

</div>

## Describe the problem/error/question

So I am sending a request to instantly.ai api it is a POST request to add leads to a campaign. The issue is that the JSON isn’t valid even though I have already validated it with 2 different JSON validators.

Here’s what I know so far, when I have it on fixed mode with hardcoded data it works fine. When I have it on expression mode with the input I get from my webhook I start getting the invalid JSON error.

## What is the error message (if any)?

```auto
JSON parameter needs to be valid JSON

NodeOperationError: JSON parameter needs to be valid JSON at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:207:39) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:632:42) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:872:62 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1206:20

```

## Please share your workflow

## Share the output returned by the last node

## Information on your n8n setup

- **n8n version: 4.2**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud**
- **Operating system: Windows 10**

---

<div class="post-metadata">

**Author:** ![ihortom](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ihortom/32/11473_2.png) [@ihortom](https://community.n8n.io/u/ihortom)\
**Post date:** [January 24, 2025, 3:21am UTC](https://community.n8n.io/t/http-request-node-json-error/72121/2 "2025-01-24T03:21:48Z")

</div>

Welcome to the community @Logan_Spencer !

> **Tip for sharing information**
>
> #### Pasting your n8n workflow
> 
> * * *
> 
> Ensure to copy your n8n workflow and paste it in the _code block_, that is in between the pairs of triple backticks, which also could be achieved by clicking `</>` (preformatted text) in the editor and pasting in your workflow.
> 
> ```  
> \<your workflow\>  
> ```
> 
> That implies to any JSON output you would like to share with us.
> 
> Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!
> 
> * * *

The outcome depends on the actual value that expressions are substituted for. If you have `null`, arrays, and objects then the resulting JSON will break. The solutions is to include the while JSOn in the expression. Something like

```auto
{{
  {
      "api_key": "apikey",
      "campaign_id": "campaignid",
      "skip_if_in_workspace": false,
      "skip_if_in_campaign": true,
      "leads": [
          {
              "email": $('Webhook').item.json.body.agent_email,
              "first_name": $('Edit Fields').item.json['First Name']",
              "last_name": $('Edit Fields').item.json['Last Name'],
              "company_name": $('Webhook').item.json.body.broker_name,
              "personalization": $json.output,
              "phone": $('Webhook').item.json.body.agent_phones[0].number",
              "website": "instantly.ai"
          }
      ]
  }
}}

```

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [April 24, 2025, 3:22am UTC](https://community.n8n.io/t/http-request-node-json-error/72121/3 "2025-04-24T03:22:33Z")

</div>

Closed on April 24, 2025, 3:22am UTC

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