From b7ee8f1cf0e2705a143fc246702d9a999278ceae Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 1 Apr 2020 13:00:05 -0300 Subject: [PATCH] mention that JSON operators work for row filtering (#314) --- api.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api.rst b/api.rst index 0cb77ee17..d05788ce2 100644 --- a/api.rst +++ b/api.rst @@ -200,17 +200,20 @@ You can specify a path for a ``json`` or ``jsonb`` column using the arrow operat 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": 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"}] } ] +That also works with filters: + .. code-block:: http - GET /people?select=id,json_data->phones->0->>number HTTP/1.1 + GET /people?select=id,json_data->blood_type&json_data->>blood_type=eq.A- HTTP/1.1 [ - { "id": 1, "number": "917-929-5745"}, - { "id": 2, "number": "512-446-4988"} + { "id": 1, "blood_type": "A-" }, + { "id": 3, "blood_type": "A-" }, + { "id": 7, "blood_type": "A-" } ] .. _computed_cols: