Skip to content

unescaped newlines in JSON output #2557

@zachmu

Description

@zachmu

From customer report:

postgres=> SELECT '{"v":"a\\nb"}'::jsonb;
 e'{"v":"a\\\\nb"}' 
--------------------
 {"v": "a\         +
 b"}
(1 row)

postgres=> SELECT $${"v":"a\\nb"}$$::jsonb;
 e'{"v":"a\\\\nb"}' 
--------------------
 {"v": "a\         +
 b"}
(1 row)

postgres=> SELECT $${"v":"a\\\nb"}$$::jsonb;
 e'{"v":"a\\\\\\nb"}' 
----------------------
 {"v": "a\\nb"}
(1 row)

Compare to postgres output:

# SELECT '{"v":"a\\nb"}'::jsonb;
 e'{"v":"a\\\\nb"}'
     jsonb      
----------------
 {"v": "a\\nb"}
(1 row)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions