Note
Kailangan ng pahintulot para ma-access ang page na ito. Maaari mong subukang mag-sign in o magpalit ng mga direktoryo.
Ang pag-access sa pahinang ito ay nangangailangan ng pahintulot. Maaari mong subukang baguhin ang mga direktoryo.
Converts a DataFrame into a RDD of string or DataFrame.
Syntax
toJSON(use_unicode: bool = True)
Parameters
| Parameter | Type | Description |
|---|---|---|
use_unicode |
bool, optional, default True | Whether to convert to unicode or not. Note that this argument is disallowed in Spark Connect mode. |
Returns
:class:RDD (in Classic mode) or `:class:`DataFrame (in connect mode)
Examples
df = spark.createDataFrame([(2, "Alice"), (5, "Bob")], schema=["age", "name"])
df.toJSON().first()
# '{"age":2,"name":"Alice"}'