Skip to content

Removes all properties with null values from a JSON object.

func.json_strip_nulls(<json_string>)
func.json_strip_nulls(func.parse_json('{"name": "alice", "age": 30, "city": null}'))
┌─────────────────────────────────────────────────────────────────────────────────────────────────┐
│ func.json_strip_nulls(func.parse_json('{"name": "alice", "age": 30, "city": null}')) │
│ String │
├─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ {"age":30,"name":"Alice"} │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
JSON_STRIP_NULLS(<json_string>)

Returns a value of the same type as the input JSON value.

SELECT JSON_STRIP_NULLS(PARSE_JSON('{"name": "Alice", "age": 30, "city": null}'));
json_strip_nulls(parse_json('{"name": "alice", "age": 30, "city": null}'))|
--------------------------------------------------------------------------+
{"age":30,"name":"Alice"} |