Read a Dataset NDJSON file to a datasetjson object
Source:R/read_dataset_ndjson.R
read_dataset_ndjson.RdReads a newline-delimited JSON (NDJSON) file following the Dataset JSON v1.1.0 specification. Line 1 of the file holds the dataset metadata and each subsequent line holds one data row as a JSON array.
Details
NDJSON and JSON representations of Dataset JSON carry the same content, so
the object returned here is the same as the one read_dataset_json()
returns for the equivalent .json file, including all of the metadata
attached as attributes. See read_dataset_json() for the full list.
Examples
# Read one of the example files shipped with the package
dm <- read_dataset_ndjson(datasetjson_example("dm.ndjson"))
# Or from NDJSON text held in memory
ds_json <- dataset_json(
iris,
item_oid = "IG.IRIS",
name = "IRIS",
dataset_label = "Iris",
columns = iris_items
)
dat <- read_dataset_ndjson(write_dataset_ndjson(ds_json))