Skip to main content

Scalar Functions — JSON / Dynamic

KQL treats JSON objects and arrays as first-class dynamic values. These functions let you extract fields, pack values into objects or arrays, and serialize dynamic data back to JSON strings. Dotted property access (obj.field) is supported across all dialects and is rewritten as a json_extract_string call automatically.

Legend: ✅ Supported · ⚠️ Approximated · ❌ Not Supported · 🔄 Rewritten

FunctionSQLiteMySQLClickHousePostgreSQLNotes
json_extract_string()json_extract / JSONExtractString / ->>
json_extract_raw()json_extract / JSONExtractRaw / ->
dynamic_to_json()ClickHouse: toJSONString; Postgres: CAST to text
parse_json()
bag_pack() / pack()json_object / jsonb_build_object / map()
pack_all()Dynamic column enumeration has no SQL equivalent
pack_array()ClickHouse: array(); Postgres: ARRAY()
bag_keys()ClickHouse: mapKeys()
bag_merge()ClickHouse: mapMerge()
Dotted property access obj.fieldMapped to json_extract_string