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

From msn
Subject Getting the queried result in the form of json structure
Date
Msg-id 1461670320290-5900554.post@n5.nabble.com
Whole thread Raw
Responses Re: Getting the queried result in the form of json structure  (Hector Vass <hector.vass@metametrics.co.uk>)
Re: Getting the queried result in the form of json structure  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-sql
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   ============   -
insertinto 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.



pgsql-sql by date:

Previous
From: msn
Date:
Subject: Re: org.postgresql.util.PSQLException: ERROR: index row requires more memory than default(8191)
Next
From: Hector Vass
Date:
Subject: Re: Getting the queried result in the form of json structure