Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1av1Gq-0005Jx-BG for pgsql-sql@arkaria.postgresql.org; Tue, 26 Apr 2016 11:35:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1av1Go-0005Co-L3 for pgsql-sql@arkaria.postgresql.org; Tue, 26 Apr 2016 11:35:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1av1Dx-000451-GI for pgsql-sql@postgresql.org; Tue, 26 Apr 2016 11:32:13 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1av1Dm-0004aY-Iz for pgsql-sql@postgresql.org; Tue, 26 Apr 2016 11:32:13 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 4349F262E398 for ; Tue, 26 Apr 2016 04:17:50 -0700 (PDT) Date: Tue, 26 Apr 2016 04:32:00 -0700 (MST) From: msn To: pgsql-sql@postgresql.org Message-ID: <1461670320290-5900554.post@n5.nabble.com> Subject: Getting the queried result in the form of json structure MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.3 (/) 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 I am using postgresql for my webapplication. I am new to this Postgresql-json. I Just want to get the select query result in the form of json structure. Here are my details: Create table ============ - create table sample(id, serial, info jsonb); Insert query ============ - insert into sample("info") values('{"person": {"phone": 9804484234,"name":{"firstname":"Alice", "lastname":"bob"}, "empId": "E067", "age":25}'); select query: ============= select "info"->'person'->>'lastname' from sample; result: bob but I want to get the above result along with the json nodes like below: result: {"person": {"name": {"lastname":"bob"} } } could any tell me how to get my expected result structure from database. -- View this message in context: http://postgresql.nabble.com/Getting-the-queried-result-in-the-form-of-json-structure-tp5900554.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql