Contents
jsonb_object_keys()
A function returning the set of keys in the top-level jsonb JSON object
jsonb_object_keys()
is a system function returning the set of keys in the top-level jsonb
JSON object.
jsonb_object_keys()
was added in PostgreSQL 9.4.
Usage
jsonb_object_keys (json
) → setoftext
The returned list contains one entry for each key, apparently in alphabetical order.
Change history
- PostgreSQL 9.4
- added (commit d9134d0a)
Examples
Basic usage example for jsonb_object_keys()
:
postgres=# SELECT jsonb_object_keys( $$ {"foo": {"bar": "bip"}, "bar": {"bat": "bop", "baz": "zoo"}} $$ ); jsonb_object_keys ------------------- bar foo (2 rows)
References
- PostgreSQL documentation: JSON Processing Functions