Extract data from JSONB - Mailing list pgsql-general

From Alex Magnum
Subject Extract data from JSONB
Date
Msg-id CA+cR4zdTKZDVbd7L+Ymm=6byXBw8DbPQfbqUg==W7fE944Yh-Q@mail.gmail.com
Whole thread Raw
Responses Re: Extract data from JSONB  (Michael Paquier <michael.paquier@gmail.com>)
List 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 by date:

Previous
From: Sandeep Gupta
Date:
Subject: Re: how to serialize insert followed by read(select) by different clients
Next
From: Michael Paquier
Date:
Subject: Re: Extract data from JSONB