Re: JSON fields with backslashes - Mailing list pgsql-general

From Tom Lane
Subject Re: JSON fields with backslashes
Date
Msg-id 1593973.1697234503@sss.pgh.pa.us
Whole thread Raw
In response to JSON fields with backslashes  (Greig Wise <greigwise@comcast.net>)
List pgsql-general
Greig Wise <greigwise@comcast.net> writes:
> Hello.  I have run into an issue when using the copy command on tables
> with json columns where Postgres seems to improperly escape backslashes
> under certain conditions thus creating invalid JSON.

AFAICS this is COPY's normal behavior: it doubles backslashes in
the default format.  You could use CSV format, perhaps, but that
has its own quoting rules that also mean that what comes out is
not going to be json-and-nothing-but.  See "File Formats" here:

https://www.postgresql.org/docs/current/sql-copy.html

            regards, tom lane



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: JSON fields with backslashes
Next
From: Erik Wienhold
Date:
Subject: Re: JSON fields with backslashes