Re: Getting the queried result in the form of json structure - Mailing list pgsql-sql

From Adrian Klaver
Subject Re: Getting the queried result in the form of json structure
Date
Msg-id 6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com
Whole thread Raw
In response to Re: Getting the queried result in the form of json structure  (msn <pioneer.suri@gmail.com>)
List pgsql-sql
On 04/29/2016 02:40 AM, msn wrote:
> Could any body please tell me, Is my requirement possible? It would be
> appreciated if i get the response, because It is completely blocking my
> task.

Did you try Hectors suggestion:

"cast it
select info::text from sample;"

test=# select info::text from sample;                                                       info 

------------------------------------------------------------------------------------------------------------------
{"person":{"age": 25, "name": {"lastname": "bob", "firstname": 
 
"Alice"}, "empId": "E067", "phone": 9804484234}}


If that is not what you want there are a whole slew of functions that 
allow you to manipulate the data:

http://www.postgresql.org/docs/9.5/interactive/functions-json.html

*NOTE* the above is from Postgres 9.5, not all of them may be available 
in earlier version.

>
>
>
> --
> View this message in context:
http://postgresql.nabble.com/Getting-the-queried-result-in-the-form-of-json-structure-tp5900554p5901157.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-sql by date:

Previous
From: msn
Date:
Subject: Re: Getting the queried result in the form of json structure
Next
From: "David G. Johnston"
Date:
Subject: Re: Getting the queried result in the form of json structure