Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aw90M-00083x-Ip for pgsql-sql@arkaria.postgresql.org; Fri, 29 Apr 2016 14:02:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aw90M-00052s-5L for pgsql-sql@arkaria.postgresql.org; Fri, 29 Apr 2016 14:02:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aw90K-0004zZ-Jl for pgsql-sql@postgresql.org; Fri, 29 Apr 2016 14:02:49 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aw90H-0003hX-Ee for pgsql-sql@postgresql.org; Fri, 29 Apr 2016 14:02:47 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 394B920E83 for ; Fri, 29 Apr 2016 10:02:44 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 29 Apr 2016 10:02:44 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=wVh7aWNr2d2hZ+E0kvAgmaE3+cA=; b=k/jPna C0ylQfABJ5gAJZ5wPFdjp63MicPZaR7GPhGMUuwu4xAEQhQPwECvbr06jgLfRJaX SBVX00mS4C6uE3MAaIcgAfELYUwaZGs21zy8x0fdeMWSmECRoHNV71vOYsQgRIma 7d4wJCHHNIpS8HeDmy9oKT0a7QtDF7MRMEExY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=wVh7aWNr2d2hZ+E 0kvAgmaE3+cA=; b=si71++Nonk7+JnInBic3AZwTIU99E5Z8jE2pGSRdJsAQJ8/ /aP90s/bukOVaDhkdQWiepO6yTTZTtJhK398wazysj3JjT0vu4HPIqfLPc4MY5O8 cO+odcH7QPfAIAEd9/P4mo/DORuxxgl0ETD31DUCqeFumpAXsrx128ygU/Rs= X-Sasl-enc: E8voy7hLDQc6PJUYqKFxhMw3FwzUQeRr8iBGjEbLfR2W 1461938563 Received: from [192.168.1.2] (174-24-160-10.tukw.qwest.net [174.24.160.10]) by mail.messagingengine.com (Postfix) with ESMTPA id A341AC0001C; Fri, 29 Apr 2016 10:02:43 -0400 (EDT) Subject: Re: Getting the queried result in the form of json structure To: msn , pgsql-sql@postgresql.org References: <1461670320290-5900554.post@n5.nabble.com> <1461731536628-5900735.post@n5.nabble.com> <1461922844770-5901157.post@n5.nabble.com> From: Adrian Klaver Message-ID: <6304d291-ec07-2519-9430-f0919b2d254b@aklaver.com> Date: Fri, 29 Apr 2016 07:02:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1461922844770-5901157.post@n5.nabble.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org 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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql