# Error: The data in "Body Parameters" is no valid JSON. When JSON IS valid

**URL:** <https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111>\
**Category:** Questions\
**Tags:** node\
**Created:** [August 5, 2021, 7:49pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111 "2021-08-05T19:49:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirland](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirland/32/5740_2.png) [@sirland](https://community.n8n.io/u/sirland)\
**Post date:** [August 5, 2021, 7:49pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/1 "2021-08-05T19:49:10Z")

</div>

I’m trying to send this JSON via HTTP request:

```
{
	"row": {
		"id": "610a9a7b9441800004da5988",
		"full_name": "Name",
		"email": "name@gmail.com",
		"mobile": 000000000,
		"membership_id": "610a9a7b9441800004da5989",
		"membership_status": "active",
		"role_id": "rol-0001",
		"subscription_id": "60e7ab9bdd79d800047d24d0",
		"hubspot_id": "2e6b945d3b212b5ebc249e78b7f73cbe",
		"mixpanel_id": "17b1165e5b720-016cb7b23f6be-2c085940-448e0-17b1165e5c11d",
		"terms_agreement": true,
		"marketing_authorization": false
	},
	"table_name": "users"
}

```

No matter what I do, I always get the same error. I validated the JSON externally and does not seem to be a problem with that.

---

<div class="post-metadata">

**Author:** ![sirland](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirland/32/5740_2.png) [@sirland](https://community.n8n.io/u/sirland)\
**Post date:** [August 5, 2021, 8:01pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/2 "2021-08-05T20:01:36Z")

</div>

I’m using this expression

```
{
	"row": {
		"id": "{{$node["New member"].json["body"]["id"]}}",
		"full_name": {{JSON.stringify($node["New member"].json["body"]["profile"]["nombre-completo"])}},
		"email": {{JSON.stringify($node["New member"].json["body"]["email"])}},
		"mobile": {{$node["New member"].json["body"]["profile"]["celular"]}},
		"membership_id": "{{$node["New member"].json["body"]["membership"]["id"]}}",
		"membership_status": "{{$node["New member"].json["body"]["membership"]["status"]}}",
		"role_id": {{JSON.stringify($node["New member"].json["body"]["profile"]["rol"])}},
		"subscription_id": "{{$node["New member"].json["body"]["membership"]["subscribed_to"]}}",
		"hubspot_id": "{{$node["New member"].json["body"]["profile"]["huid"]}}",
		"mixpanel_id": {{JSON.stringify($node["New member"].json["body"]["profile"]["mpid"])}},
		"terms_agreement": {{$node["New member"].json["body"]["profile"]["terms"]}},
		"marketing_authorization": {{$node["New member"].json["body"]["profile"]["promo"]}}
	},
	"table_name": "users"
}

```

And this is the node:

```
{
  "nodes": [
    {
      "parameters": {
        "authentication": "headerAuth",
        "requestMethod": "POST",
        "url": "={{$node[\"Set tokens\"].json[\"server\"]}}dtable-server/api/v1/dtables/{{$node[\"Set tokens\"].json[\"id\"]}}/rows/",
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={\n\t\"row\": {\n\t\t\"id\": \"{{$node[\"New member\"].json[\"body\"][\"id\"]}}\",\n\t\t\"full_name\": {{JSON.stringify($node[\"New member\"].json[\"body\"][\"profile\"][\"nombre-completo\"])}},\n\t\t\"email\": {{JSON.stringify($node[\"New member\"].json[\"body\"][\"email\"])}},\n\t\t\"mobile\": {{$node[\"New member\"].json[\"body\"][\"profile\"][\"celular\"]}},\n\t\t\"membership_id\": \"{{$node[\"New member\"].json[\"body\"][\"membership\"][\"id\"]}}\",\n\t\t\"membership_status\": \"{{$node[\"New member\"].json[\"body\"][\"membership\"][\"status\"]}}\",\n\t\t\"role_id\": {{JSON.stringify($node[\"New member\"].json[\"body\"][\"profile\"][\"rol\"])}},\n\t\t\"subscription_id\": \"{{$node[\"New member\"].json[\"body\"][\"membership\"][\"subscribed_to\"]}}\",\n\t\t\"hubspot_id\": \"{{$node[\"New member\"].json[\"body\"][\"profile\"][\"huid\"]}}\",\n\t\t\"mixpanel_id\": {{JSON.stringify($node[\"New member\"].json[\"body\"][\"profile\"][\"mpid\"])}},\n\t\t\"terms_agreement\": {{$node[\"New member\"].json[\"body\"][\"profile\"][\"terms\"]}},\n\t\t\"marketing_authorization\": {{$node[\"New member\"].json[\"body\"][\"profile\"][\"promo\"]}}\n\t},\n\t\"table_name\": \"users\"\n}"
      },
      "name": "Create new user",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        550,
        330
      ],
      "notesInFlow": true,
      "retryOnFail": true,
      "waitBetweenTries": 300,
      "credentials": {
        "httpHeaderAuth": "Main DB Base Token (R/W)"
      },
      "notes": "Seatable"
    }
  ],
  "connections": {}
}
```

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [August 5, 2021, 8:59pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/3 "2021-08-05T20:59:19Z")

</div>

If it says that it is invalid, I assume it sadly is. Did you check the resolved data and if everything is 100% correct there? I am sadly not able to debug it as all the input data is missing and have so no idea what it will resolve to myself. To be able to debug it, would a mock “New member” node be required with example data. That can be done easiest with a Function-Node.

---

<div class="post-metadata">

**Author:** ![sirland](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirland/32/5740_2.png) [@sirland](https://community.n8n.io/u/sirland)\
**Post date:** [August 5, 2021, 9:31pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/4 "2021-08-05T21:31:49Z")

</div>

> [@sirland](#):
>
> ```auto
> {
> "row": {
> "id": "610a9a7b9441800004da5988",
> "full_name": "Name",
> "email": "name@gmail.com",
> "mobile": 000000000,
> "membership_id": "610a9a7b9441800004da5989",
> "membership_status": "active",
> "role_id": "rol-0001",
> "subscription_id": "60e7ab9bdd79d800047d24d0",
> "hubspot_id": "2e6b945d3b212b5ebc249e78b7f73cbe",
> "mixpanel_id": "17b1165e5b720-016cb7b23f6be-2c085940-448e0-17b1165e5c11d",
> "terms_agreement": true,
> "marketing_authorization": false
> },
> "table_name": "users"
> }
> 
> ```

This is the resolved data, if I copy and paste the resolved data on another workflow, the node passes without errors. But if I use the expression on the original workflow, it gets me an error, let me check if I can mock the data for you to debug.

---

<div class="post-metadata">

**Author:** ![sirland](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirland/32/5740_2.png) [@sirland](https://community.n8n.io/u/sirland)\
**Post date:** [August 5, 2021, 9:46pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/5 "2021-08-05T21:46:30Z")

</div>

Here are the nodes with the mock up data:

```
{
  "nodes": [
    {
      "parameters": {
        "authentication": "headerAuth",
        "requestMethod": "POST",
        "url": "={{$node[\"Set tokens\"].json[\"server\"]}}dtable-server/api/v1/dtables/{{$node[\"Set tokens\"].json[\"id\"]}}/rows/",
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={\n\t\"row\": {\n\t\t\"id\": \"{{$node[\"New member\"].json[\"body\"][\"id\"]}}\",\n\t\t\"full_name\": {{JSON.stringify($node[\"New member\"].json[\"body\"][\"profile\"][\"nombre-completo\"])}},\n\t\t\"email\": {{JSON.stringify($node[\"New member\"].json[\"body\"][\"email\"])}},\n\t\t\"mobile\": {{$node[\"New member\"].json[\"body\"][\"profile\"][\"celular\"]}},\n\t\t\"membership_id\": \"{{$node[\"New member\"].json[\"body\"][\"membership\"][\"id\"]}}\",\n\t\t\"membership_status\": \"{{$node[\"New member\"].json[\"body\"][\"membership\"][\"status\"]}}\",\n\t\t\"role_id\": \"{{$node[\"New member\"].json[\"body\"][\"profile\"][\"rol\"]}}\",\n\t\t\"subscription_id\": \"{{$node[\"New member\"].json[\"body\"][\"membership\"][\"subscribed_to\"]}}\",\n\t\t\"hubspot_id\": \"{{$node[\"New member\"].json[\"body\"][\"profile\"][\"huid\"]}}\",\n\t\t\"mixpanel_id\": \"{{$node[\"New member\"].json[\"body\"][\"profile\"][\"mpid\"]}}\",\n\t\t\"terms_agreement\": {{$node[\"New member\"].json[\"body\"][\"profile\"][\"terms\"]}},\n\t\t\"marketing_authorization\": {{$node[\"New member\"].json[\"body\"][\"profile\"][\"promo\"]}}\n\t},\n\t\"table_name\": \"users\"\n}"
      },
      "name": "Create new user",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        830,
        350
      ],
      "notesInFlow": true,
      "retryOnFail": true,
      "waitBetweenTries": 300,
      "credentials": {
        "httpHeaderAuth": "Main DB Base Token (R/W)"
      },
      "notes": "Seatable"
    },
    {
      "parameters": {
        "filePath": "/root/data/tokens.json"
      },
      "name": "Get tokens",
      "type": "n8n-nodes-base.readBinaryFile",
      "typeVersion": 1,
      "position": [
        480,
        350
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Set tokens",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        670,
        350
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n { \n json:\n{\n\"headers\": {\n\"x-real-ip\": \"184.72.168.109\",\n\"x-forwarded-for\": \"184.72.168.109\",\n\"host\": \"instantvoices.hooks.n8n.cloud\",\n\"x-forwarded-proto\": \"https\",\n\"x-nginx-proxy\": \"true\",\n\"connection\": \"close\",\n\"content-length\": \"610\",\n\"accept\": \"application/json\",\n\"content-type\": \"application/json\"\n},\n\"params\": {\n},\n\"query\": {\n},\n\"body\": {\n\"id\": \"610c4361e6e830000410a135\",\n\"email\": \"agusalbor@gmail.com\",\n\"profile\": {\n\"nombre-completo\": \"Agustin Albornoz\",\n\"celular\": \"1159244084\",\n\"huid\": \"38476cd9a02f9d7a28471733c024e20b\",\n\"mpid\": \"17b17e6889329a-071ac809f69307-4343363-e1000-17b17e68894803\",\n\"pageuri\": \"www.instantvoices.com/cuenta/registro-locutor\",\n\"pagename\": \"Registro locutor\",\n\"terms\": true,\n\"promo\": false,\n\"rol\": \"rol-0002\",\n\"ip\": \"200.126.195.33\",\n\"id\": \"610c4361e6e830000410a135\"\n},\n\"membership\": {\n\"id\": \"610c4361e6e830000410a136\",\n\"subscribed_to\": \"60e7ab9bdd79d800047d24d0\",\n\"status\": \"active\",\n\"type\": \"free\",\n\"test_mode\": true\n},\n\"created_at\": \"2021-08-05T20:00:33.000Z\"\n}\n}\n}\n]"
      },
      "name": "New member",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        310,
        350
      ]
    }
  ],
  "connections": {
    "Get tokens": {
      "main": [
        [
          {
            "node": "Set tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set tokens": {
      "main": [
        [
          {
            "node": "Create new user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New member": {
      "main": [
        [
          {
            "node": "Get tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

```

If I use expression the node gives me the invalid JSON error, if I paste the resolved data, it continues without a problem.

---

<div class="post-metadata">

**Author:** ![sirland](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirland/32/5740_2.png) [@sirland](https://community.n8n.io/u/sirland)\
**Post date:** [August 5, 2021, 10:00pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/6 "2021-08-05T22:00:44Z")

</div>

@jan I found the bug, your JSON parser does not recognize a false value if it comes from a node expression, it only recognizes true values. I believe this is a bug on n8n’s side.

Even if I do this workaround, it does not work:  
`"marketing_authorization": {{($node["New member"].json["body"]["profile"]["promo"]) ? true : false}}`

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [August 5, 2021, 10:10pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/7 "2021-08-05T22:10:28Z")

</div>

Guess because it is not actually a string and rather a real boolean value. You can make sure that it is a string by adding `.toString()`. It will then work fine. For example:

```javascript
{{$node["New member"].json["body"]["profile"]["promo"].toString()}}

```

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [August 9, 2021, 10:44am UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/8 "2021-08-09T10:44:16Z")

</div>

Hey @sirland,

Did your issue got resolved? Let us know if you need help 🙂

---

<div class="post-metadata">

**Author:** ![sirland](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/sirland/32/5740_2.png) [@sirland](https://community.n8n.io/u/sirland)\
**Post date:** [August 9, 2021, 4:14pm UTC](https://community.n8n.io/t/error-the-data-in-body-parameters-is-no-valid-json-when-json-is-valid/7111/9 "2021-08-09T16:14:41Z")

</div>

Yes, thank you @harshil1712 and @jan I had to use a string instead of a boolean value.
