Circle V2 API Docs
    Preparing search index...

    Function toJsonbArray

    • 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.

      Type Parameters

      • T

      Parameters

      • values: readonly T[]

      Returns RawBuilder<T[]>