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