Skip to main content

builtin_to_json

Function builtin_to_json 

Source
fn builtin_to_json(
    args: &[RValue],
    _named: &[(String, RValue)],
) -> Result<RValue, RError>
Expand description

Convert an R value to a JSON string.

Conversion rules:

  • Named list -> JSON object
  • Unnamed list -> JSON array
  • Vector of length 1 -> JSON scalar
  • Vector of length > 1 -> JSON array
  • NULL -> null

@param x R value to convert @return character scalar containing the JSON string