Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Parses a column containing a JSON string into a VariantType. Throws exception if a string represents an invalid JSON value.
Syntax
from pyspark.sql import functions as sf
sf.parse_json(col)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
A column or column name JSON formatted strings. |
Returns
pyspark.sql.Column: a new column of VariantType.
Examples
from pyspark.sql import functions as sf
df = spark.createDataFrame([ {'json': '''{ "a" : 1 }'''} ])
df.select(sf.to_json(sf.parse_json(df.json))).collect()
[Row(to_json(parse_json(json))='{"a":1}')]