JSON_PRETTY (Lakehouse v1)
Formats JSON data, making it more readable and presentable. It automatically adds indentation, line breaks, and other formatting to the JSON data for better visual representation.
Analyze Syntax
Section titled “Analyze Syntax”func.json_pretty(<json_string>)Analyze Examples
Section titled “Analyze Examples”func.json_pretty(func.parse_json('{"person": {"name": "bob", "age": 25}, "location": "city"}'))
┌─────────────────────────────────────────────────────────────────────────────────────────────────┐│ func.json_pretty(func.parse_json('{"person": {"name": "bob", "age": 25}, "location": "city"}')) ││ String │├─────────────────────────────────────────────────────────────────────────────────────────────────┤│ { ││ "location": "City", ││ "person": { ││ "age": 25, ││ "name": "Bob" ││ } ││ } │└─────────────────────────────────────────────────────────────────────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”JSON_PRETTY(<json_string>)Return Type
Section titled “Return Type”String.
SQL Examples
Section titled “SQL Examples”SELECT JSON_PRETTY(PARSE_JSON('{"name":"Alice","age":30}'));
---┌──────────────────────────────────────────────────────┐│ json_pretty(parse_json('{"name":"alice","age":30}')) ││ String │├──────────────────────────────────────────────────────┤│ { ││ "age": 30, ││ "name": "Alice" ││ } │└──────────────────────────────────────────────────────┘
SELECT JSON_PRETTY(PARSE_JSON('{"person": {"name": "Bob", "age": 25}, "location": "City"}'));
---┌───────────────────────────────────────────────────────────────────────────────────────┐│ json_pretty(parse_json('{"person": {"name": "bob", "age": 25}, "location": "city"}')) ││ String │├───────────────────────────────────────────────────────────────────────────────────────┤│ { ││ "location": "City", ││ "person": { ││ "age": 25, ││ "name": "Bob" ││ } ││ } │└───────────────────────────────────────────────────────────────────────────────────────┘