2

I'm trying to create a row manually via DBeaver and I am entering the following in a jsonb column:

{"US":"0.880","PA":"0.028","KY":"0.025"}

I've checked that this is valid JSON on https://jsonformatter.curiousconcept.com/#

However, this is what I get:

enter image description here

Any insight would be appreciated...

I even tried surrounding the object with single quotes like:

'{"US":"0.880","PA":"0.028","KY":"0.025"}'

But got an error about how the ' is an invalid token...

I was writing a nodejs script to insert a json stringified object into the column but I was getting the same error so I decided to manually try it and I can't even insert the above data...

4
  • Please add details to question, this works nicely on Postgres: select '{"US":"0.880","PA":"0.028","KY":"0.025"}'::jsonb;. (Using PostgreSQL 12.6 (Ubuntu 12.6-0ubuntu0.20.10.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0, 64-bit). Commented May 30, 2021 at 11:13
  • I'm adding the object manually via DBEAVER (DBMS) to the column... shouldn't it work? Commented May 30, 2021 at 11:18
  • Check the servers log file to see what it was sent. Commented May 30, 2021 at 13:01
  • 1
    Agree with @jjanes: This may be more an issue with DBEAVER than with PostgreSQL itself. Commented Jun 13, 2021 at 7:01

2 Answers 2

2

I can insert this data in jsonb column in DBeaver via UI without problem.

But we have issue about input in json(not jsonb) column in table which has no primary key. Maybe is this your case https://github.com/dbeaver/dbeaver/issues/11704 ?

Or can you show table DDL?

insertjsonb

Sign up to request clarification or add additional context in comments.

1 Comment

Hey, thanks for checking. I basically moved on. I still don't know why it wasn't working. It works if I insert it using an SQL query though. What I was doing is using the 'create column' functionality in the 'view table data' section
1

I have succeeded inserting your provided {"US":"0.880","PA":"0.028","KY":"0.025"} JSON into the JSONB column through the DBeaver table UI.

However, I had a similar problem with regularly formatted (indented) JSON. For me it worked to minify the JSON to a oneliner and try to insert that into the JSONB column. I used https://codebeautify.org/jsonminifier to do this.

I think the problem might be related to newlines / whitespace.

1 Comment

I see, interesting find

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.