Extract data from JSONB

Поиск
Список
Период
Сортировка
От Alex Magnum
Тема Extract data from JSONB
Дата
Msg-id CA+cR4zdTKZDVbd7L+Ymm=6byXBw8DbPQfbqUg==W7fE944Yh-Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: Extract data from JSONB  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-general
Hi,
I need some help with extracting data from json.

I have the following jsonb field

modules  
   "accounts":     {"status": true}, 
   "admin":        {"status": true}, 
   "calendar":     {"status": false}, 
   "chat":         {"status": true}, 
   "contacts":     {"status": true}, 
   "dashboard":    {"status": false}, 
   "help":         {"status": true}
}   

How can I convert that into one row each based on status; for example if I only want to have the active modules.

Only true
   
module    | status
----------+-------
accounts  | true
admin     | true
contacts  | true
help      | true

Thanks for any advise

В списке pgsql-general по дате отправления:

Предыдущее
От: Sandeep Gupta
Дата:
Сообщение: Re: how to serialize insert followed by read(select) by different clients
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Extract data from JSONB