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
| Function | SQLite | MySQL | ClickHouse | PostgreSQL | DuckDB | Notes |
|---|---|---|---|---|---|---|
json_extract_string() | ✅ | ✅ | ✅ | ✅ | ✅ | json_extract / JSONExtractString / ->> / json_extract_string |
json_extract_raw() | ✅ | ✅ | ✅ | ✅ | ✅ | json_extract / JSONExtractRaw / -> |
dynamic_to_json() | ❌ | ❌ | ✅ | ✅ | ✅ | ClickHouse: toJSONString; Postgres: CAST to text; DuckDB: CAST to VARCHAR |
parse_json() | ❌ | ✅ | ✅ | ✅ | ✅ | Parses a string to a dynamic value: DuckDB/MySQL CAST to JSON, Postgres CAST to jsonb |
todynamic() / toobject() | ❌ | ✅ | ✅ | ✅ | ✅ | ClickHouse: JSONExtractRaw; Postgres: CAST to jsonb; DuckDB: CAST to JSON; MySQL: JSON_EXTRACT($) |
extract_json() / extractjson() | ✅ | ✅ | ✅ | ⚠️ | ✅ | JSONPath extraction with optional type cast; DuckDB: json_extract_string; Postgres: simple paths only (#>>) |
bag_pack() / pack() / pack_dictionary() | ✅ | ✅ | ✅ | ✅ | ✅ | json_object / jsonb_build_object / map(); DuckDB: json_object |
pack_all() | ❌ |