json
jsonb_populate_record
Maps object fields to a composite type; unmatched fields retain base values when base is non-NULL.
Formal Syntax & Structure
sql syntaxsql
jsonb_populate_record(base anyelement, from_json jsonb)Working Example
Example Snippetsql
CREATE TYPE lab_row AS (id int, label text); SELECT * FROM jsonb_populate_record(NULL::lab_row, '{"id":7}');