fromJSON

0th

Percentile

Convert JSON To R

Convert a JSON object into an R object.

Keywords
interface
Usage
fromJSON( json_str, file, method = "C", unexpected.escape = "error" )
Arguments
json_str
a JSON object to convert
file
the name of a file to read the json_str from; this can also be a URL. Only one of json_str or file must be supplied.
method
use the C implementation, or the older slower (and one day to be depricated) R implementation
unexpected.escape
changed handling of unexpected escaped characters. Handling value should be one of "error", "skip", or "keep"; on unexpected characters issue an error, skip the character, or keep the character
Value

See Also

toJSON

Aliases
  • fromJSON
Examples

#watch out for R turning null into FALSE
fromJSON( "[true, false, null]" )
##[1]  TRUE FALSE __FALSE__

#but if you use a hash, this will be avoided
fromJSON( '{"a":true, "b":false, "c":null}' )


#R vs C
x <- toJSON( iris )
system.time( y <- fromJSON(x) )
system.time( y2 <- fromJSON(x,method = "R") )

Documentation reproduced from package rjson, version 0.2.15, License: GPL-2

Community examples

Looks like there are no examples yet.