how to select array in postgresql?

I have json like this (in my databases) ==>

[
  {
   "name": "Shahin",
   "biography": "I am an Iranian person to Persian rap \n",
   "is_private": false,
  }
]

now I want to get "Shahin", any help would be appreciated.

?

Answers 1

  • you should use this

    SELECT id,(val->>'name')
    FROM your_table_name, 
         jsonb_array_elements(YOURCOLUMN) val 
    

Related Articles