>From: pgsql-general-ow...@postgresql.org 
>[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Marc Mamin
>Sent: Montag, 23. Mai 2016 16:03
>To: pgsql-general@postgresql.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
>


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to