Re: [GENERAL] Extract data from JSONB

2016-08-07 Thread Charles Clavadetscher
Hello > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Michael Paquier > Sent: Montag, 8. August 2016 05:24 > To: Alex Magnum > Cc: Postgres General > Subject: Re: [GENERAL] Extract data f

Re: [GENERAL] Extract data from JSONB

2016-08-07 Thread Michael Paquier
On Mon, Aug 8, 2016 at 12:08 PM, Alex Magnum wrote: > How can I convert that into one row each based on status; for example if I > only want to have the active modules. You can use jsonb_each to decompose that: =# select key, (value::json)->'status' from jsonb_each('{

[GENERAL] Extract data from JSONB

2016-08-07 Thread Alex Magnum
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":