read_json_duckdb {duckplyr} | R Documentation |
Read JSON files using DuckDB
Description
read_json_duckdb()
reads a JSON file using DuckDB's read_json()
table function.
Usage
read_json_duckdb(
path,
...,
prudence = c("thrifty", "lavish", "stingy"),
options = list()
)
Arguments
path |
Path to files, glob patterns |
... |
These dots are for future extensions and must be empty. |
prudence |
Memory protection, controls if DuckDB may convert intermediate results in DuckDB-managed memory to data frames in R memory.
The default is |
options |
Arguments to the DuckDB |
See Also
read_csv_duckdb()
, read_parquet_duckdb()
Examples
# Create and read a simple JSON file
path <- tempfile("duckplyr_test_", fileext = ".json")
writeLines('[{"a": 1, "b": "x"}, {"a": 2, "b": "y"}]', path)
# Reading needs the json extension
db_exec("INSTALL json")
db_exec("LOAD json")
read_json_duckdb(path)
[Package duckplyr version 1.1.0 Index]