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

Return Postgres array as well-formed JSON list #47

Open
sveniu opened this issue Jan 14, 2014 · 0 comments
Open

Return Postgres array as well-formed JSON list #47

sveniu opened this issue Jan 14, 2014 · 0 comments
Labels

Comments

@sveniu
Copy link

sveniu commented Jan 14, 2014

It would be great if Postgres arrays would be returned as bare, well-formed JSON lists, so that a result would look like this:

{ "rows": [
  { "col1": "foo", "arr1": [ "foo", "bar", "baz" ] }
]}

..including correct typing (no quotes around int[] or float[], etc).

The main benefit is ease of use by applications, not having to do something like a list comprehension to obtain the list of values.

The drawbacks include: Postgres only; XML has no concept of a list, so there would have to be a work-around using a parent-child element list.

This is a feature I've enjoyed immensely in the Python psycopg2 interface, and would love to carry on using it!

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

No branches or pull requests

1 participant