json

to_json

Converts a SQL value to JSON, recursively converting arrays and composites.

Formal Syntax & Structure

sql syntaxsql
to_json(anyelement)

Working Example

Example Snippetsql
SELECT to_json(ARRAY[7,9]);
SQL Reference