select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / JSON FUNCTIONS AND OPERATORS

Converts an SQL composite value to a JSON object.

Signatures & examples

row_to_json ( record [, boolean ] ) → json
Converts an SQL composite value to a JSON object. The behavior is the same as to_json except that line feeds will be added between top-level elements if the optional boolean parameter is true.
row_to_json(row(1,'foo')) → {"f1":1,"f2":"foo"}
Version history 5
  1. PG 13 → 14changed
  2. PG 12 → 13changed
  3. PG 9.3 → 9.4changed
  4. PG 9.2 → 9.3changed
  5. PG 9.1 → 9.2added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source