tojson-crunch | R Documentation |
crunch
uses the jsonlite
package for JSON serialization and
deserialization. Unfortunately, jsonlite::toJSON()
does not allow for defining S4 methods for other object types. So,
crunch::toJSON
wraps jsonprep
, which exists to translate
objects to base R objects, which jsonlite::toJSON
can handle.
jsonprep
is defined as an S4 generic, and it is exported, so you can define
methods for it if you have other
objects that you want to successfully serialize to JSON.
jsonprep(x, ...)
## S4 method for signature 'AbstractCategories'
jsonprep(x, ...)
## S4 method for signature 'ANY'
jsonprep(x, ...)
## S4 method for signature 'ShojiOrder'
jsonprep(x, ...)
## S4 method for signature 'OrderGroup'
jsonprep(x, ...)
toJSON(x, ..., for_query_string = FALSE)
x |
the object |
... |
additional arguments |
for_query_string |
If |
jsonprep
returns a base R object that jsonlite::toJSON
can handle. toJSON
returns the JSON-serialized character object.
jsonlite::toJSON()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.