नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
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"}'