Loading jsonb postgres data

How can I load JSONB data using Postgres snaps? I’m able to load the data as TEXT type but not as JSONB type.
Below is how I’m setting up my pipeline for inserting data to postgres db: image

Any answers would be appreciated!

Hi @anayak

If you are able to load it as TEXT easiest fix would be in the mapper to use JSON.stringify(value) function. This function will convert your value into JSON string.

Also you can try to insert your records with “PostgreSQL - Bulk Load” or with “PostgreSQL - Execute” snaps.

Pero Manchevski

I have tried JSON.stringify and Json.parse, the value is converted to JSON but not read as jsonb when run with Postgres-Insert snap. Will try bulk load and execute snaps instead. Thanks!

@pmanchevski When I use Bulk Load, the auto-increment process_id column can’t be left empty but it does allow loading jsonb data. If I use Insert snap, then JSON.stringify() does make a json string but Inser Snap reads it implicitly as varchar/text and I have no way to typecast in the Insert Snap.
Also, as the data is coming from an excel file where $(all of the excel file data) is used in a column in the table, I’m not sure how to load the data as JSONB using the execute or insert snap.

Here’s the mapper fields:

followed by Insert:

Never mind, was able to resolve by casting to jsonb using the execute snap. Thanks!