objectAsJSON: Construct a String in JSON Notation to Represent an R Object

Description Usage Arguments Details Value Methods (by class) References

Description

The XR structure requires a server-language function objectFromJSON() which parses an object description in JSON. Methods for generic function objectAsJSON() should produce the appropriate string.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
objectAsJSON(object, prototype = prototypeObject(), level = 1)

## S4 method for signature 'array'
objectAsJSON(object, prototype = prototypeObject(),
  level = 1)

## S4 method for signature 'environment'
objectAsJSON(object, prototype = prototypeObject(),
  level = 1)

## S4 method for signature 'list'
objectAsJSON(object, prototype = prototypeObject(),
  level = 1)

## S4 method for signature 'envRefClass'
objectAsJSON(object, prototype = prototypeObject(),
  level = 1)

## S4 method for signature 'Interface'
objectAsJSON(object, prototype = prototypeObject(),
  level = 1)

## S4 method for signature 'AssignedProxy'
objectAsJSON(object, prototype = prototypeObject(),
  level = 1)

## S4 method for signature 'ProxyClassObject'
objectAsJSON(object,
  prototype = prototypeObject(), level = 1)

Arguments

object

The object to be converted.

prototype

The prototype server class; see asServerObject.

level

Will be 1 for top-level call, incremented when recalled for an element. Used to make choices about scalars.

Details

This function is typically called from a method for asServerObject. Methods for objectAsJSON() in turn often call one or both of two helper functions: asJSONS4(), which produces the full description of the R object; and typeToJSON(), which produces the code for the basic R types, ignoring all class or attribute information.

Value

A string that will be parsed according to JSON grammar.

Methods (by class)

References

Chambers, John M. (2016) Extending R, Chapman & Hall/CRC. ( Chapter 13, discussing this package, is included in the package: ../doc/Chapter_XR.pdf.)


XR documentation built on March 19, 2018, 1:04 a.m.