↑↓ 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.

Reading PG 18current·documented in 16 of 27 versions, 9.2 to 20

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. 13 → 14 changed
  2. 12 → 13 changed
  3. 9.3 → 9.4 changed
  4. 9.2 → 9.3 changed
  5. 9.1 → 9.2 added

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