pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: msn <pioneer.suri@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Getting the queried result in the form of json structure
Date: Fri, 29 Apr 2016 07:02:42 -0700
Message-ID: <6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com> (raw)
In-Reply-To: <1461922844770-5901157.post@n5.nabble.com>
References: <1461670320290-5900554.post@n5.nabble.com>
	<DB5PR0601MB2008C389C5CC5A21FABC1E7ABC630@DB5PR0601MB2008.eurprd06.prod.outlook.com>
	<1461731536628-5900735.post@n5.nabble.com>
	<1461922844770-5901157.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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-tp5900554p5901...
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


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



view thread (7+ messages)  latest in thread

Message-ID: <6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com>
Permalink:  ../6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com/
Also on:    postgresql.org/message-id/6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: adrian.klaver@aklaver.com, pioneer.suri@gmail.com
  Subject: Re: Getting the queried result in the form of json structure
  In-Reply-To: <6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox