Contents
jsonb_each_text()
A function expanding the top-level JSON object into a set of key/value pairs
jsonb_each_text()
is a system function which expands the top-level jsonb
object into a set of key/value pairs, with the value returned as text
.
jsonb_each_text()
was added in PostgreSQL 9.4.
Usage
jsonb_each_text (json
) → setof record (key
text
,value
text
)
To extract the value as jsonb
, use jsonb_each()
.
Change history
- PostgreSQL 9.4
- added (commit d9134d0a)
Examples
Basic usage example for jsonb_each_text()
:
SELECT key, value, pg_typeof(value) FROM jsonb_each_text('{"a":"foo", "b":{"bar":"baz"}}'); key | value | pg_typeof -----+----------------+----------- a | foo | text b | {"bar": "baz"} | text (2 rows)
References
- PostgreSQL documentation: JSON Processing Functions