TO_JSON (Lakehouse v2)
Converts a SQL value to a JSON value.
Analyze Syntax
Section titled “Analyze Syntax”func.to_json(get_column(table, 'struct_col'))Analyze Examples
Section titled “Analyze Examples”func.to_json(func.named_struct('name', 'Alice', 'age', 30))
┌───────────────────────────┐│ {"name":"Alice","age":30} │└───────────────────────────┘SQL Syntax
Section titled “SQL Syntax”TO_JSON(<struct_col>)SQL Examples
Section titled “SQL Examples”SELECT TO_JSON(NAMED_STRUCT('name', 'Alice', 'age', 30));
┌───────────────────────────┐│ {"name":"Alice","age":30} │└───────────────────────────┘