PostgREST adds wrappers and quotations to GeoJSON output #2339
-
Environment
Description of issueTrying to build a GeoJSON endpoint, I noticed that queries that work fine via psql have additional wrapper entities wrapped around them when getting them via PostgREST, which breaks the GeoJSON parser in Mapbox: Table and view:
The above view approach is taken from #1894 output from psql:
but via curl I get:
Note the "json_build_object" wrapper. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Defining the view like this appears to work:
|
Beta Was this translation helpful? Give feedback.
-
As Steve suggested, I created a PR in the docs that modifies the example from a VIEW to a FUNCTION in order to return a JSON object and not an Array. Here is the example if you need it: https://postgrest.org/en/latest/how-tos/working-with-postgresql-data-types.html#postgis |
Beta Was this translation helpful? Give feedback.
As Steve suggested, I created a PR in the docs that modifies the example from a VIEW to a FUNCTION in order to return a JSON object and not an Array. Here is the example if you need it: https://postgrest.org/en/latest/how-tos/working-with-postgresql-data-types.html#postgis