prorm API Reference
    Preparing search index...

    Function jsonKeys

    • Get the list of top-level keys of a JSON object.

      • mysql/mariadb: JSON_KEYS(col) -> native, returns a JSON array of keys.
      • postgres/cockroachdb: ARRAY(SELECT jsonb_object_keys(col)) -> a SQL text array of keys.
      • sqlite: (SELECT json_group_array(key) FROM json_each(col)) -> a JSON array of keys, built from SQLite's own json_each table-valued function.
      • snowflake: OBJECT_KEYS(col) -> native, returns an ARRAY of keys.
      • clickhouse: JSONExtractKeys(col) -> native, returns an Array(String).
      • mssql: no native function returns a JSON/array value of keys inline; OPENJSON requires a derived table, so the closest inline expression is a scalar subquery producing a comma-separated string (NOT a JSON array): (SELECT STRING_AGG([key], ',') FROM OPENJSON(col)).
      • oracle, redshift, db2: throw "not supported" - none of these dialects expose a documented function/operator that enumerates JSON object keys as a value usable inline in a SELECT list, so faking one with a fragile workaround would be worse than a clear error.

      Parameters

      Returns { $literal: string }