| From: | Marc Mamin <M(dot)Mamin(at)intershop(dot)de> |
|---|---|
| To: | Marc Mamin <M(dot)Mamin(at)intershop(dot)de>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: revert function for to_json ? |
| Date: | 2016-05-23 14:22:18 |
| Message-ID: | B6F6FD62F2624C4C9916AC0175D56D8842154FD9@jenmbs01.ad.intershop.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
>From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Marc Mamin
>Sent: Montag, 23. Mai 2016 16:03
>To: pgsql-general(at)postgresql(dot)org
>Subject: [GENERAL] revert function for to_json ?
>
>Hello,
>
>I'm looking for $subject
>
>example:
>
>how to revert
> select to_json(E'a\n''b'::text)
>
>I can achieve it with something like this:
> select json_extract_path_text(('{"a":'||to_json(E'a\n''b'::text)||'}')::json,'a')
>
>does anybody knows a less ugly solution ?
I just found the solution here: http://stackoverflow.com/questions/27215216/postgres-how-to-convert-json-string-to-text
:-)
select to_json(E'a\n''b'::text)#>>'{}'
>
>regards,
>
>Marc Mamin
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruno Wolff III | 2016-05-23 14:27:29 | Re: Postgresql-fdw |
| Previous Message | David G. Johnston | 2016-05-23 14:19:09 | Re: postgresql embedded mode |