
Encode an R object as JSON (jsonlite's toJSON, natively)
Source:R/jsonlt_native.R
morie_jsonlt_to_json.RdEvery option of jsonlite's toJSON() with the same default and the same
bytes out: dataframe, matrix, Date, POSIXt, factor, complex,
raw, null, na, auto_unbox, digits (I(n) for significant
digits, NA for 15), pretty (TRUE = 2 spaces, or a width), force,
plus rownames, keep_vec_names, json_verbatim, always_decimal,
time_format, UTC, no_dots, hms.
Usage
morie_jsonlt_to_json(
x,
dataframe = c("rows", "columns", "values"),
matrix = c("rowmajor", "columnmajor"),
Date = c("ISO8601", "epoch"),
POSIXt = c("string", "ISO8601", "epoch", "mongo"),
factor = c("string", "integer"),
complex = c("string", "list"),
raw = c("base64", "hex", "mongo", "int", "js"),
null = c("list", "null"),
na = c("null", "string"),
auto_unbox = FALSE,
digits = 4,
pretty = FALSE,
force = FALSE,
...
)Arguments
- x
the object to encode.
- dataframe, matrix, Date, POSIXt, factor, complex, raw, null, na, auto_unbox, digits, force
as in jsonlite.
- pretty
FALSE, TRUE, or an indent width.
- ...
toJSON options: dataframe (rows, columns, values), matrix (rowmajor, columnmajor), Date (ISO8601, epoch), POSIXt (string, ISO8601, epoch, mongo), factor (string, integer), complex (string, list), raw (base64, hex, int, mongo), null (list, null), na (NULL, null, string), auto_unbox, digits, force.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_jsonlt_to_json(V)
#> [1,2,3,4,5,6,7,8]