Encode a JS array for writing into a Postgres jsonb[] (array-of-jsonb) column —
e.g. form_answers.value / form_answers.coordinates_snapshot.
Neither driver can be trusted with a bare JS array here: pg serializes it into a
Postgres array literal whose element quoting breaks on embedded quotes/backslashes in
JSON, and postgres.js auto-JSON-encodes the whole array into a single jsonb value,
which fails against a jsonb[] column. Building an explicit ARRAY[...]::jsonb[]
expression with one toJsonb-style element per entry is correct under both.
Encode a JS array for writing into a Postgres
jsonb[](array-of-jsonb) column — e.g.form_answers.value/form_answers.coordinates_snapshot.Neither driver can be trusted with a bare JS array here:
pgserializes it into a Postgres array literal whose element quoting breaks on embedded quotes/backslashes in JSON, andpostgres.jsauto-JSON-encodes the whole array into a singlejsonbvalue, which fails against ajsonb[]column. Building an explicitARRAY[...]::jsonb[]expression with onetoJsonb-style element per entry is correct under both.