mdb-json is a utility program distributed with MDB Tools. It produces JSON output for the given table. Such output is suitable for parsing in a variety of languages.

mdb_json(
  path,
  table,
  date_format = "%Y-%m-%d",
  time_format = "%Y-%m-%d %H:%M:%S",
  no_unprintable = FALSE,
  n = -1L
)

Arguments

path

Path to .mdb/.accdb file.

table

Table name.

date_format

Equivalent to -D/--date-format.

time_format

Equivalent to -T/--time-format.

no_unprintable

Equivalent to -U/--no-unprintable.

n

Optional row limit.

Value

JSON string.

Examples

db <- mdbr:::.mdb_example_nwind_path()
if (nzchar(db) && requireNamespace("jsonlite", quietly = TRUE)) {
  mdb_json(db, "Products", n = 2)
}
#> [{"ProductID":1,"ProductName":"Chai","SupplierID":1,"CategoryID":1,"QuantityPerUnit":"10 boxes x 20 bags","UnitPrice":18,"UnitsInStock":39,"UnitsOnOrder":0,"ReorderLevel":10,"Discontinued":false},{"ProductID":2,"ProductName":"Chang","SupplierID":1,"CategoryID":1,"QuantityPerUnit":"24 - 12 oz bottles","UnitPrice":19,"UnitsInStock":17,"UnitsOnOrder":40,"ReorderLevel":25,"Discontinued":false}]