Postgresql INSERT Issue (JSONB)

I need some advice where I’m heading wrong.
So the scenario is that I’m inserting a JSON object into a Postgresql table (to a JSONB column) for warehousing purposes. When I run the query manually on the database everything works as expected but on the n8n Postgres node it fails with a syntax error due to the Postgres node adding a unexpected [object Object] reference.

The issue can be replicated by using the query that’s visible in the first screen shot below (note the [object Object] in values).

INSERT INTO payment_data (record_id, doc_id, json_data)
VALUES (3, 319, [object Object]);

The expected result from the Postgres node expression is:

INSERT INTO payment_data (record_id, doc_id, json_data)
VALUES (1, 319, '{"key":"value"}');

What is the way to omit the [Object] reference to get the query working? I should note that [Object] is placed by JSON > data > raw value selection.

Found a solution: one way to solve this is to use the Function node

items[0].json.payload = JSON.stringify({"key": "value"});
return items

which bypasses the object rendering in the Postgres node since the data is coming in as a string, resulting in a correctly executed SQL statement.

thanks for sharing the solution with the community @sigmet