# Sanitized JSON Insert into Postgres

**URL:** <https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754>\
**Category:** Questions\
**Created:** [March 3, 2025, 1:06pm UTC](https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754 "2025-03-03T13:06:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicole\_Reiter](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/nicole_reiter/32/50410_2.png) [@Nicole\_Reiter](https://community.n8n.io/u/Nicole_Reiter)\
**Post date:** [March 3, 2025, 1:06pm UTC](https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754/1 "2025-03-03T13:06:06Z")

</div>

I’m trying to insert a JSONB into my database, which works correctly with the syntax below. However when I try to use the sanitized syntax using $1 it returns error invalid JSON:

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

![image](https://europe1.discourse-cdn.com/n8n/optimized/3X/d/0/d0e54fb4a780e64d2f2d60f7fe977534155e3b90_2_690x66.png)

---

<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:** [March 3, 2025, 1:06pm UTC](https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754/2 "2025-03-03T13:06:07Z")

</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:** ![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:** [March 17, 2025, 8:58pm UTC](https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754/3 "2025-03-17T20:58:30Z")

</div>

hello @Nicole_Reiter

How did the sanitized syntax look?

---

<div class="post-metadata">

**Author:** ![Nicole\_Reiter](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/nicole_reiter/32/50410_2.png) [@Nicole\_Reiter](https://community.n8n.io/u/Nicole_Reiter)\
**Post date:** [March 19, 2025, 10:00am UTC](https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754/4 "2025-03-19T10:00:35Z")

</div>

Like this:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/3/e/3e8f1da21a91b5e38fa071ebc7964df8dc454ca9.png)  
Also the toggle “replace empty strings with NULL” was not working as expected

---

<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:** [March 19, 2025, 11:38am UTC](https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754/5 "2025-03-19T11:38:41Z")

</div>

I suppose you can’t use type definitions ( :: ) in the Query Parameters.

Try to set them on the variables instead, e.g. `$10::TIMESTAMPZ`

---

<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:** [June 17, 2025, 11:39am UTC](https://community.n8n.io/t/sanitized-json-insert-into-postgres/83754/6 "2025-06-17T11:39:33Z")

</div>

Closed on June 17, 2025, 11:39am UTC

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