This function is intended to have a preconfigured toJSON function to allow a user to visualize a process or graph in JSON. The JSON representation of a process is the same as it will be sent to the back-end.
# S4 method for class 'Process'
toJSON(
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,
...
)
# S4 method for class 'Graph'
toJSON(
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,
...
)
a Process or Graph object
how to encode data.frame objects: must be one of 'rows', 'columns' or 'values'
how to encode matrices and higher dimensional arrays: must be one of 'rowmajor' or 'columnmajor'.
how to encode Date objects: must be one of 'ISO8601' or 'epoch'
how to encode POSIXt (datetime) objects: must be one of 'string', 'ISO8601', 'epoch' or 'mongo'
how to encode factor objects: must be one of 'string' or 'integer'
how to encode complex numbers: must be one of 'string' or 'list'
how to encode raw objects: must be one of 'base64', 'hex' or 'mongo'
how to encode NULL values within a list: must be one of 'null' or 'list'
how to print NA values: must be one of 'null' or 'string'. Defaults are class specific
automatically unbox()
all atomic vectors of length 1. It is usually safer to avoid this and instead use the unbox()
function to unbox individual elements.
An exception is that objects of class AsIs
(i.e. wrapped in I()
) are not automatically unboxed. This is a way to mark single values as length-1 arrays.
max number of decimal digits to print for numeric values. Use I()
to specify significant digits. Use NA
for max precision.
adds indentation whitespace to JSON output. Can be TRUE/FALSE or a number specifying the number of spaces to indent. See prettify()
unclass/skip objects of classes with no defined JSON mapping
additional parameters that are passed to jsonlite::toJSON
JSON string of the process as a character string
if (FALSE) { # \dontrun{
# node is a defined process node
process = as(node, "Process")
toJSON(process)
graph = process$getProcessGraph()
toJSON(graph)
} # }