# HTTP Request Getting an error in n8n Node

**URL:** <https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462>\
**Category:** Questions\
**Tags:** http-request\
**Created:** [February 19, 2024, 3:44am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462 "2024-02-19T03:44:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmilaDeshan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/amiladeshan/32/27932_2.png) [@AmilaDeshan](https://community.n8n.io/u/AmilaDeshan)\
**Post date:** [February 19, 2024, 3:44am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/1 "2024-02-19T03:44:37Z")

</div>

Hi there,

I have tried to do a POST request using HTTP Request Node. When I try to do that I am getting an error like in the below.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/9/b/9b757016520915cc8a31c6821a09d3ce5364daec.png)

But When I try that body parameter in the POSTMAN, It is working fine.

{ “Order”: [{ “Username”:“amila1329112206”, “OrderID”:“N376”, “OrderType”:“Quote”, “[Email":"amila@tools.com](mailto:Email%22:%22amila@tools.com)”, “BillFirstName”:“tt”, “BillLastName”:“tt”, “BillCompany”:“”, “BillStreet1”:“151 Melbourne Road”, “BillStreet2”:“”, “BillCity”:“Rippleside”, “BillState”:“VIC”, “BillPostCode”:“3215”, “BillContactPhone”:“(070) 155-6276”, “BillCountry”:“AU”, “ShipFirstName”:“tt”, “ShipLastName”:“tt”, “ShipCompany”:“”, “ShipStreet1”:“151 Melbourne Road”, “ShipStreet2”:“”, “ShipCity”:“Rippleside”, “ShipState”:“VIC”, “ShipPostCode”:“3215”, “ShipContactPhone”:“(070) 155-6276”, “ShipCountry”:“AU”, “CustomerRef6”:“:::36:::5.07::::::576791::1::4.88:::64MLH904::1::0.19:::”, “OrderStatus”:“Quote”, “OrderApproval”:“False”, “PaymentMethod”:“”, “TaxInclusive”:“True”, “TaxFreeShipping”:“False”, “ShippingMethod”:“Standard Shipping”, “ShippingCost”:“0.00”, “ShippingDiscount”:“0.00”, “SignatureRequired”:“True”, “CurrencyCode”:“AUD”, “SalesChannel”:“Website”, “OrderLine”:[{“SKU”: “576791”, “ItemDescription”: " Festool Beech Tenon 8mm / 10mm Starter SystainerSet for DF 700 (576791)", “Quantity”: “1”, “Price”: “4.88”, “WarehouseName”: “Location #1”, “TaxFree”: “False”},{“SKU”: “64MLH904”, “ItemDescription”: " PERFECT FINISH DRYING SYSTEM ", “Quantity”: “1”, “Price”: “0.19”, “WarehouseName”: “Location #1”, “TaxFree”: “False”}] }]}

This is my body parameter.

Do you have any idea why this is not working on HTTP Request but its working on Postman?

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/196425_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [February 19, 2024, 3:44am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/2 "2024-02-19T03:44:39Z")

</div>

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:**

---

<div class="post-metadata">

**Author:** ![AmilaDeshan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/amiladeshan/32/27932_2.png) [@AmilaDeshan](https://community.n8n.io/u/AmilaDeshan)\
**Post date:** [February 19, 2024, 3:45am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/3 "2024-02-19T03:45:25Z")

</div>

n8n version: 1.22.4  
\*\*Database - SQLite n8n EXECUTIONS\_PROCESS  
setting - Own Running  
n8n via - Docker  
Operating system: Windows

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [February 19, 2024, 5:46pm UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/4 "2024-02-19T17:46:07Z")

</div>

hello @AmilaDeshan

Please, don’t use the raw content type for JSON. Use the JSON type. Example:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/8/b/8bfc29f14ce857f4d098dfcfeb49fbd5f508251d.png)

---

<div class="post-metadata">

**Author:** ![AmilaDeshan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/amiladeshan/32/27932_2.png) [@AmilaDeshan](https://community.n8n.io/u/AmilaDeshan)\
**Post date:** [February 20, 2024, 3:09am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/5 "2024-02-20T03:09:29Z")

</div>

Hello @barn4k

Thank you for the update. But when I use that one, I am getting an error **ERROR: JSON parameter need to be an valid JSON**

Please check my below input JSON and OUTPUT of it,

Input JSON  
{  
“Order”: [  
{  
“Username”: “{{ $json.Username\_new }}”,  
“OrderID”: “{{ $json.orderID }}”,  
“OrderType”: “Quote”,  
“Email”: “{{ $json.email\_address }}”,  
“BillFirstName”: “{{ $json.bill\_first\_name }}”,  
“BillLastName”: “{{ $json.bill\_last\_name }}”,  
“BillCompany”: “{{ $json.companyName}}”,  
“BillStreet1”: “{{ $json.billing\_street}}”,  
“BillStreet2”: “”,  
“BillCity”: “{{ $json.billing\_city }}”,  
“BillState”: “{{ $json.billing\_state }}”,  
“BillPostCode”: “{{ $json.billing\_zip }}”,  
“BillContactPhone”: “{{ $json.phone\_number}}”,  
“BillCountry”: “{{ $json.billing\_country ===‘AU’ ? ‘Australia’ :‘$json.billing\_country’ }}”,  
“ShipFirstName”: “{{ $json.bill\_first\_name }}”,  
“ShipLastName”: “{{ $json.bill\_last\_name }}”,  
“ShipCompany”: “{{ $json.companyName }}”,  
“ShipStreet1”: “{{ $json.shipping\_street }}”,  
“ShipStreet2”: “”,  
“ShipCity”: “{{ $json.shipping\_city }}”,  
“ShipState”: “{{ $json.shipping\_state }}”,  
“ShipPostCode”: “{{ $json.shipping\_zip }}”,  
“ShipContactPhone”: “{{ $json.phone\_number }}”,  
“ShipCountry”: “{{ $json.shipping\_country ===‘AU’ ? ‘Australia’ : ‘$json.shipping\_country’ }}”,  
“CustomerRef6”: “{{ $json.q117\_cusref6 }}”,  
“OrderStatus”: “Quote”,  
“OrderApproval”: “False”,  
“PaymentMethod”: “”,  
“TaxInclusive”: “True”,  
“TaxFreeShipping”: “False”,  
“ShippingMethod”: “Standard Shipping”,  
“ShippingCost”: “0.00”,  
“ShippingDiscount”: “0.00”,  
“SignatureRequired”: “True”,  
“CurrencyCode”: “AUD”,  
“SalesChannel”: “Website”,  
“OrderLine”: [  
{{ $json.OrderLine }}  
]  
}  
]  
}

Result of the above input

{  
“Order”: [  
{  
“Username”: “8mctmhmtoalm”,  
“OrderID”: “kwucpbtt1818”,  
“OrderType”: “Quote”,  
“Email”: “[deshanamila@gmail.com](mailto:deshanamila@gmail.com)”,  
“BillFirstName”: “tt”,  
“BillLastName”: “tt”,  
“BillCompany”: “”,  
“BillStreet1”: “151 Melbourne Road”,  
“BillStreet2”: “”,  
“BillCity”: “Rippleside”,  
“BillState”: “VIC”,  
“BillPostCode”: “3215”,  
“BillContactPhone”: “(070) 155-6276”,  
“BillCountry”: “Australia”,  
“ShipFirstName”: “tt”,  
“ShipLastName”: “tt”,  
“ShipCompany”: “”,  
“ShipStreet1”: “151 Melbourne Road”,  
“ShipStreet2”: “”,  
“ShipCity”: “Rippleside”,  
“ShipState”: “VIC”,  
“ShipPostCode”: “3215”,  
“ShipContactPhone”: “(070) 155-6276”,  
“ShipCountry”: “Australia”,  
“CustomerRef6”: “:::36:::5.07::::::576791::1::4.88:::64MLH904::1::0.19:::”,  
“OrderStatus”: “Quote”,  
“OrderApproval”: “False”,  
“PaymentMethod”: “”,  
“TaxInclusive”: “True”,  
“TaxFreeShipping”: “False”,  
“ShippingMethod”: “Standard Shipping”,  
“ShippingCost”: “0.00”,  
“ShippingDiscount”: “0.00”,  
“SignatureRequired”: “True”,  
“CurrencyCode”: “AUD”,  
“SalesChannel”: “Website”,  
“OrderLine”: [  
{“SKU”: “576791”, “ItemDescription”: " Festool Beech Tenon 8mm / 10mm Starter SystainerSet for DF 700 (576791)", “Quantity”: “1”, “Price”: “4.88”, “WarehouseName”: “”, “TaxFree”: “False”},{“SKU”: “64MLH904”, “ItemDescription”: " PERFECT FINISH DRYING SYSTEM ", “Quantity”: “1”, “Price”: “0.19”, “WarehouseName”: “”, “TaxFree”: “False”}  
]  
}  
]  
}

When I execute the node, I am getting **ERROR: JSON parameter need to be an valid JSON**

This error,

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [February 20, 2024, 6:27am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/6 "2024-02-20T06:27:31Z")

</div>

At first glance, it looks good, but I don’t like the part with

```js
"OrderLine": [
{{ $json.OrderLine }}
]

```

if **OrderLine** is an array of objects (as in your output example), it should be set as:

```auto
"OrderLine": {{ $json.OrderLine }}

```

---

<div class="post-metadata">

**Author:** ![AmilaDeshan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/amiladeshan/32/27932_2.png) [@AmilaDeshan](https://community.n8n.io/u/AmilaDeshan)\
**Post date:** [February 20, 2024, 10:58am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/7 "2024-02-20T10:58:28Z")

</div>

OrderLine is requesting a parameter like below.

“OrderLine”: [  
{  
“SKU”: “576791”,  
“ItemDescription”: " Festool Beech Tenon 8mm / 10mm Starter SystainerSet for DF 700 (576791)",  
“Quantity”: “1”,  
“Price”: “4.88”,  
“WarehouseName”: “”,  
“TaxFree”: “False”  
},  
{  
“SKU”: “64MLH904”,  
“ItemDescription”: " PERFECT FINISH DRYING SYSTEM ",  
“Quantity”: “1”,  
“Price”: “0.19”,  
“WarehouseName”: “”,  
“TaxFree”: “False”  
}  
]

$json.OrderLine value is coming like below.

{  
“SKU”: “576791”,  
“ItemDescription”: " Festool Beech Tenon 8mm / 10mm Starter SystainerSet for DF 700 (576791)",  
“Quantity”: “1”,  
“Price”: “4.88”,  
“WarehouseName”: “”,  
“TaxFree”: “False”  
},  
{  
“SKU”: “64MLH904”,  
“ItemDescription”: " PERFECT FINISH DRYING SYSTEM ",  
“Quantity”: “1”,  
“Price”: “0.19”,  
“WarehouseName”: “”,  
“TaxFree”: “False”  
}

I need to add that $json.OrderLine value inside [], but when I did that, I am getting that JSON Error

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [February 20, 2024, 11:23am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/8 "2024-02-20T11:23:10Z")

</div>

No, you shouldn’t place the `$json.OrderLine` inside square brackets `[]`. Because it’s already having them (if the `$json.OrderLine` is not a text). You can open the dev console (f12) and see in the **console tab** what the node sends when you are running the **HTTP Node**.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/7/a/7ab54b455293971a0910f94f58e4d01ca20b9056.png)

---

<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:** [May 20, 2024, 11:23am UTC](https://community.n8n.io/t/http-request-getting-an-error-in-n8n-node/40462/9 "2024-05-20T11:23:54Z")

</div>

Closed on May 20, 2024, 11:23am UTC

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