Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Adds an example for JSON data

Paul Copplestone1234993cbd22
diff --git a/web/docs/library/examples/get.js b/web/docs/library/examples/get.js
index d0ca653756e..6e3abb1919b 100644
--- a/web/docs/library/examples/get.js
+++ b/web/docs/library/examples/get.js
@@ -443,3 +443,17 @@ const getCountries = async () => {
return countries
${errorJs}
`.trim()
+
+export const getJsonData = `
+${importJs}
+const getCountries = async () => {
+ try {
+ let countries = await supabase
+ .from('countries')
+ .select(\`
+ json_column_name->>population,
+ json_column_name->weather->>temperature
+ \`)
+ return countries
+ ${errorJs}
+`.trim()
diff --git a/web/docs/library/get.mdx b/web/docs/library/get.mdx
index babe7b3b755..d2b7b713dbb 100644
--- a/web/docs/library/get.mdx
+++ b/web/docs/library/get.mdx
@@ -15,6 +15,7 @@ import {
getColumnsJs,
getForeignJs,
getForeignMultipleJs,
+ getJsonData,
getOrderJs,
getEmbeddedOrderJs,
getLimitJs,
@@ -176,6 +177,18 @@ the supplier and the purchaser at the same time (both in the `users`) table:
}`}
/>
+### Quering JSON data
+
+If you have data inside of a JSONB column, you can apply select and query filters to the data values.
+Postgres offers a [number of operators](https://www.postgresql.org/docs/9.5/functions-json.html) for querying JSON data.
+Also see [PostgREST](http://postgrest.org/en/v7.0.0/api.html#json-columns) docs for more details.
+
+<CustomCodeBlock
+ header="Shows how to reference a foreign table when it is referenced twice"
+ js={getJsonData}
+ jsHighlight="{9-12}"
+/>
+
## Reference
### `from()`