crunch
uses the jsonlite
package for (de)serialization of
JSON. Unlike RJSONIO
's toJSON
, 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 (unlike
code{jsonlite::asJSON}), so you can define methods for it if you have other
objects that you want to successfully serialize to JSON.jsonprep(x, ...)## S3 method for class 'Categories':
jsonprep(x, ...)
## S3 method for class 'list':
jsonprep(x, ...)
## S3 method for class 'zcl':
jsonprep(x, ...)
## S3 method for class 'ANY':
jsonprep(x, ...)
## S3 method for class 'VariableOrder':
jsonprep(x, ...)
## S3 method for class 'VariableGroup':
jsonprep(x, ...)
toJSON(x, ...)
jsonprep
returns a base R object that jsonlite::toJSON
can handle. toJSON
returns the JSON-serialized character object.toJSON