Re: Getting the queried result in the form of json structure

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: msn <pioneer(dot)suri(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Getting the queried result in the form of json structure
Date: 2016-04-29 14:02:42
Message-ID: 6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2016-04-29 16:16:18 Re: Getting the queried result in the form of json structure
Previous Message msn 2016-04-29 09:40:44 Re: Getting the queried result in the form of json structure