Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YmlNk-0006BB-F8 for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2015 15:55:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YmlNj-0003sT-28 for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2015 15:55:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Ym69P-0004fV-If for pgsql-bugs@postgresql.org; Sat, 25 Apr 2015 19:54:07 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ym69L-00053B-HA for pgsql-bugs@postgresql.org; Sat, 25 Apr 2015 19:54:06 +0000 MIME-Version: 1.0 Subject: BUG #13160: Incorrect escaping of quotes in JSON export To: pgsql-bugs@postgresql.org From: me@andrewray.me Date: Sat, 25 Apr 2015 19:53:13 +0000 Message-ID: <20150425195313.2561.68542@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13160 Logged by: Andy Email address: me@andrewray.me PostgreSQL version: 9.3.5 Operating system: OSX Description: Postgres escapes quotes incorrectly when creating a JSON export. UPDATE models SET column='"hello"' WHERE id=1; COPY (SELECT row_to_json(models) FROM (SELECT column FROM shaders WHERE id=1) shaders) TO '/output.json'; The contents of output.json: {"column":"\\"hello\\""} You can see that the quotes are escaped improperly and it creates invalid JSON. It should be: {"column":"\"hello\""} -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs