snowflake.snowpark.functions.json_extract_path_text¶

snowflake.snowpark.functions.json_extract_path_text(col: Union[Column, str], path: Union[Column, str]) → Column[source]¶

Parses a JSON string and returns the value of an element at a specified path in the resulting JSON document.

Example:

>>> from snowflake.snowpark.functions import json_extract_path_text, to_variant
>>> df = session.create_dataframe([[{"a": "foo"}, "a"], [{"a": None}, "a"], [{"a": "foo"}, "b"], [None, "a"]], schema=["k", "v"])
>>> df.select(json_extract_path_text(to_variant("k"), "v").as_("res")).collect()
[Row(RES='foo'), Row(RES=None), Row(RES=None), Row(RES=None)]
Copy