json_extract_path_text does not unescape string values?

Viewed 76

When I run this query in Redshift, I would expect json_extract_path_text to remove the backslash from the "\"b\"" value:

select j, json_extract_path_text(j, 'a', true) as a
from (select '{"a": "\\"b\\""}' as j);

Instead, it appears that the string value is extracted verbatim, and the results look like this:

{"a": "\"b\""}
\"b\"

Is this intentional? If yes, what would be the idiomatic way to remove the backslashes?

0 Answers
Related