Categories:

Semi-structured Data Functions (Parsing)

STRIP_NULL_VALUE

Converts a JSON “null” value to a SQL NULL value. All other variant values are passed unchanged.

Examples

CREATE OR REPLACE TABLE mytable
(
  SRC Variant
);

INSERT INTO mytable
  SELECT PARSE_JSON(column1)
  FROM VALUES
  ('{
  "a": "1",
  "b": "2",
  "c": null
  }')
  , ('{
  "a": "1",
  "b": "2",
  "c": "3"
  }');

SELECT STRIP_NULL_VALUE(src:c) FROM mytable;

+-------------------------+
| STRIP_NULL_VALUE(SRC:C) |
|-------------------------|
| NULL                    |
| "3"                     |
+-------------------------+
Copy