Skip to content

Read a JSON blob into an R data frame

Reads a JSON file via a storage handler created by [init_storage_handler()(init_storage_handler/) and converts the resulting Python Polars DataFrame to an R data frame. Selected columns specified via col_classes can be cast in Polars before conversion to R.

read_json_blob_as_df(handler, blob_name, col_classes = NULL, ...)
Argument Description
handler A Python object of class StorageHandler.
blob_name The path/name of the blob/file.
col_classes A named character vector of R column classes.
... Additional arguments passed to handler$read_json_blob().

A data frame.

handler <- init_storage_handler()
df <- read_json_blob_as_df(
handler = handler,
blob_name = "sample/data.json",
col_classes = c(
id = "character",
customer_id = "character",
amount = "numeric",
active = "logical",
created_at = "POSIXct"
)
)