Skip to content
Advertisement

How to loop JSON array in postgres and access keys of the JSON?

I have a custom json with several key-value pairs. I want to loop over the length of the array, and access each of their keys, and insert into the table. The problem I am facing is during loop the query is unable to access the value.

Advertisement

Answer

the loop over jsonb array will look like this

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement