SparkR (version 2.4.6)

read.json: Create a SparkDataFrame from a JSON file.

Description

Loads a JSON file, returning the result as a SparkDataFrame By default, (JSON Lines text format or newline-delimited JSON ) is supported. For JSON (one record per file), set a named property multiLine to TRUE. It goes through the entire dataset once to determine the schema.

Usage

# S3 method for default
read.json(path, ...)

# S3 method for default jsonFile(path)

Arguments

path

Path of file to read. A vector of multiple paths is allowed.

...

additional external data source specific named properties.

Value

SparkDataFrame

Examples

Run this code
# NOT RUN {
sparkR.session()
path <- "path/to/file.json"
df <- read.json(path)
df <- read.json(path, multiLine = TRUE)
df <- jsonFile(path)
# }

Run the code above in your browser using DataLab