From cfaf588bba9a4d3ee6909042a5d5d669567e2cd9 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Tue, 19 Jun 2018 12:33:49 -0500 Subject: [PATCH] Add json operators to vertical filtering section --- api.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api.rst b/api.rst index ab0c16ffc..11ac6ae51 100644 --- a/api.rst +++ b/api.rst @@ -162,6 +162,26 @@ Casting the columns is possible by suffixing them with the double colon ``::`` p {"full_name": "Jane Doe", "salary": "120000.00"} ] +You can specify a json path for a ``json`` or ``jsonb`` column using the arrow operators(``->`` or ``->>``) as per the `PostgreSQL docs `_. + +.. code-block:: http + + GET /people?select=id,json_data->>blood_type,json_data->phones HTTP/1.1 + + [ + { "id": 1, "blood_type": "A+", "phones": [{"country_code": "61", "number": "917-929-5745"}] }, + { "id": 2, "blood_type": "O+", "phones": [{"country_code": "43", "number": "512-446-4988"}, {"country_code": "43", "number": "213-891-5979"}] } + ] + +.. code-block:: http + + GET /people?select=id,json_data->phones->0->>number HTTP/1.1 + + [ + { "id": 1, "number": "917-929-5745"}, + { "id": 2, "number": "512-446-4988"} + ] + .. _computed_cols: Computed Columns