Re: [HACKERS] Unpacking scalar JSON values

2013-08-25 Thread Josh Berkus
> > This came up recently on -bugs. See > , > where I suggested we expose the dequoting function. +1. As it is, I use btrim() heaviy with JSON data. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via

Re: [HACKERS] Unpacking scalar JSON values

2013-08-25 Thread Andrew Dunstan
On 08/24/2013 09:08 PM, Daniel Farina wrote: On Sat, Aug 24, 2013 at 6:04 PM, Daniel Farina wrote: But there's no good way I can find from the documentation to do it with a scalar: select ('"va\"lue"'::json)::text; Triggered send by accident: select ('"va\"lue"'::json)::text; text --

Re: [HACKERS] Unpacking scalar JSON values

2013-08-24 Thread Daniel Farina
On Sat, Aug 24, 2013 at 6:04 PM, Daniel Farina wrote: > But there's no good way I can find from the documentation to do it > with a scalar: select ('"va\"lue"'::json)::text; Triggered send by accident: select ('"va\"lue"'::json)::text; text --- "va\"lue" (1 row) the JSON escaping is

Re: [HACKERS] Unpacking scalar JSON values

2013-08-24 Thread Daniel Farina
On Sat, Aug 24, 2013 at 3:09 PM, Hannu Krosing wrote: > On 08/24/2013 11:36 PM, Daniel Farina wrote: >> Per report of Armin Ronacher, it's not clear how to take a scalar JSON >> string and unquote it into a regular Postgres "text" value, given what >> I can see here: >> http://www.postgresql.org/d

Re: [HACKERS] Unpacking scalar JSON values

2013-08-24 Thread Hannu Krosing
On 08/24/2013 11:36 PM, Daniel Farina wrote: > Per report of Armin Ronacher, it's not clear how to take a scalar JSON > string and unquote it into a regular Postgres "text" value, given what > I can see here: > http://www.postgresql.org/docs/9.3/static/functions-json.html > > Example: > > SELECT '"

[HACKERS] Unpacking scalar JSON values

2013-08-24 Thread Daniel Farina
Per report of Armin Ronacher, it's not clear how to take a scalar JSON string and unquote it into a regular Postgres "text" value, given what I can see here: http://www.postgresql.org/docs/9.3/static/functions-json.html Example: SELECT '"a json string"'::json; (Although this some problem could p