The RJSONIO Package

Last Release: 1.2-0 (16 Apr 2014)

This package provides facilities for reading and writing data in JSON - Javascript Object Notation - format. This allows us to read data in this format, e.g. from Web service applications, and also to export objects from R for use in Javascript/ECMAScript/ActionScript code. This is useful when generating dynamic plots with SVG (Scalable Vector Graphics), or Flash and ActionScript.

The primary functions in the package are

The package is extensible, allowing others to define S4 methods for toJSON for different R classes/types. Similarly, the fromJSON function allows the caller to specify a different callback handler which is invoked each time an element (e.g. number, string, key, start or end of an array or object) is found in the JSON content.

This package is motivated by the need to export R objects for use in creating dynamic graphics for the Web via SVG and Flash/FLEX. Initially, we used Alex Couture-Beil's rjson package. However, that does not use S4/S3 methods and so is not readily extensible, but still useful. Unfortunately, it does not used vectorized operations and so is too slow for non-trivial data. Similarly, for reading JSON data into R, it is somewhat slow and so does not scale to large data, should this be an issue.

Documentation


Duncan Temple Lang <duncan@wald.ucdavis.edu>
Last modified: Sun Aug 9 11:53:44 PDT 2009