add tag
## Bug report for output of JSON values from Postgres

Example query:
SELECT val, to_jsonb(val)
FROM (VALUES ('a'), ('"a"'), ('ab"cd')) examples(val)
Running this in dbfiddle at shows `""a""` and `"ab"cd"` for the json string values that contain a quote, where it should display `"\"a\""` and `"ab\"cd"` respectively. The backslash escaping is missing somehow.

Output from dbfiddle:

Output from pgadmin4:
Top Answer
Actually it's not just JSON, the problem appears with any backslashes in `text` columns:
SELECT backslash, length(backslash), quote, length(quote), backslash || quote AS concatenation
  VALUES (''), ('\'), ('\\')
) a(backslash), (
  VALUES (''), ('"'), ('\"')
) b(quote);

Actual result:

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.