Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To retrieve data from a nested JSONB object in Supabase:

  1. Use the -> operator to access the value of a specific key inside the nested JSONB object.

    SELECT data -> 'person' -> 'name' AS person_name
    FROM table_name;
    
  2. Use the ->> operator to access the value of a specific key inside the nested JSONB object and convert it to a text value.

    SELECT data ->> 'person' ->> 'name' AS person_name
    FROM table_name;
    
  3. Use the #> operator to access the value of a specific key path inside the nested JSONB object.

    SELECT data #> '{person, address, city}' AS person_city
    FROM table_name;
    
  4. Use the #>> operator to access the value of a specific key path inside the nested JSONB object and convert it to a text value.

    SELECT data #>> '{person, address, city}' AS person_city
    FROM table_name;