Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres 9.4 JSON response #44

Open
dukedougal opened this issue Nov 21, 2015 · 3 comments
Open

Postgres 9.4 JSON response #44

dukedougal opened this issue Nov 21, 2015 · 3 comments

Comments

@dukedougal
Copy link

Hello

I am using Postgres 9.4 with JSONB fields.

I want to do a query which returns JSON to the web browser from Nginx.

How do I do this? Currently I get a result set back that contains the field name and then JSON is provided as text.

thanks!

@agentzh
Copy link
Contributor

agentzh commented Nov 23, 2015

@dukedougal Hmm, maybe we could let ngx_rds_json module support such JSONB fields directly.

@dukedougal
Copy link
Author

After I posted the issue here I tried the following query which pretty much returns the JSON that I need.

There might be improvements or better ways to do it but at the moment I think this is probably good enough.

select row_to_json(row) from (select key, snapk->'name' as name, snapk->>'keywords' as keywords from snapk LIMIT 50 $offset_string) row;

@majj
Copy link

majj commented Oct 12, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants