| jsonenc | R Documentation |
Minimal JSON encoder. Converts an R object to a JSON string.
jsonenc(x)
x |
An R object to encode as JSON. |
This is a minimal implementation designed for creating HTTP API request bodies.
A character string containing the JSON representation.
Named list -> object {}
Unnamed list -> array []
Character -> string (with escaping)
Numeric/integer -> number
Logical -> true/false
NULL, NA -> null
Scalars (length 1) -> primitive value
Vectors (length > 1) -> array []
Unsupported types (e.g., functions) -> null
jsondec()
jsonenc(list(name = "John", age = 30L))
jsonenc(list(valid = TRUE, count = NULL))
jsonenc(list(nested = list(a = 1, b = list(2, 3))))
jsonenc(list(nums = 1:3, strs = c("a", "b")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.