Skip to contents

Converts a SparkDataFrame into a SparkDataFrame of JSON string. Each row is turned into a JSON document with columns as different fields. The returned SparkDataFrame has a single character column with the name value

Usage

# S4 method for SparkDataFrame
toJSON(x)

Arguments

x

a SparkDataFrame

Value

a SparkDataFrame

Note

toJSON since 2.2.0

Examples

if (FALSE) {
sparkR.session()
path <- "path/to/file.parquet"
df <- read.parquet(path)
df_json <- toJSON(df)
}