Querying foreign tables w SDK

Lower importance question, but wondering if I can get a cleaner implementation. Per https://supabase.com/docs/reference/javascript/select#query-foreign-tables I am able to successfully access data across a join table by doing something like this as an example:

const { data, error } = await supabase.from('countries').select(`
    name,
    country_capitals (
      city (
        name
      )
  `)


However, the data returned is:

{ 
  "name": "USA", 
  "country_capitals": [
    {"city": { "name": "Chicago" } },
    {"city": { "name": "New York" } } 
  ] 
}


Is there a way to just return the data directly without the join table nesting? Like:

  "name": "USA",
  "capitals": ["Chicago", "New York"


etc... I know I can do the transformation on the frontend, but seems cleaner if there is just a better way of requesting the data from the SDK
Performs vertical filtering with SELECT.
Was this page helpful?