Extract a value at a JSON path from expr as a typed, cross-dialect SQL expression usable in attributes / SELECT.
expr
attributes
SELECT
Dialect syntax sources (matched against this codebase's existing internal dialect helpers where they exist):
src/dialects/{mysql,mariadb}/index.ts
buildJsonExtract
JSON_UNQUOTE(JSON_EXTRACT(col, '$.path'))
JSON_EXTRACT(col, '$.path')
src/dialects/mssql/index.ts
JSON_VALUE(col, '$.path')
JSON_QUERY(col, '$.path')
src/dialects/sqlite/index.ts
CAST(json_extract(col, '$.path') AS TEXT)
json_extract(col, '$.path')
src/query-builders/where-builder.ts
#>>
#>
col #>> '{a,b}'
col #> '{a,b}'
src/dialects/snowflake/index.ts
buildJsonQuery
col:a.b::STRING
col:a.b
getDataTypeSql
src/dialects/redshift/index.ts
CAST(col.a.b AS VARCHAR)
col.a.b
JSON_VAL(col, 'a.b')
JSON_QUERY(col, '$.a.b')
JSONExtractString(col, 'a', 'b')
JSONExtractRaw(col, 'a', 'b')
Extract a value at a JSON path from
expras a typed, cross-dialect SQL expression usable inattributes/SELECT.Dialect syntax sources (matched against this codebase's existing internal dialect helpers where they exist):
src/dialects/{mysql,mariadb}/index.tsbuildJsonExtract->JSON_UNQUOTE(JSON_EXTRACT(col, '$.path'))(asText) /JSON_EXTRACT(col, '$.path').src/dialects/mssql/index.tsbuildJsonExtract->JSON_VALUE(col, '$.path')(asText) /JSON_QUERY(col, '$.path').src/dialects/sqlite/index.tsbuildJsonExtract->CAST(json_extract(col, '$.path') AS TEXT)(asText) /json_extract(col, '$.path').src/query-builders/where-builder.ts#>>/#>handling ->col #>> '{a,b}'(asText) /col #> '{a,b}'.JSON_VALUE(col, '$.path')(asText) /JSON_QUERY(col, '$.path').src/dialects/snowflake/index.tsbuildJsonQuery->col:a.b::STRING(asText) /col:a.b(VARIANT, non-text).getDataTypeSqlmapping JSON/JSONB -> SUPER insrc/dialects/redshift/index.ts) ->CAST(col.a.b AS VARCHAR)(asText) /col.a.b.JSON_VAL(col, 'a.b')(asText) /JSON_QUERY(col, '$.a.b').JSONExtractString(col, 'a', 'b')(asText) /JSONExtractRaw(col, 'a', 'b').