EVOLUTION-MANAGER
Edit File: fromJSON.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Convert JSON To R</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for fromJSON {rjson}"><tr><td>fromJSON {rjson}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Convert JSON To R</h2> <h3>Description</h3> <p> Convert a JSON object into an R object. </p> <h3>Usage</h3> <pre>fromJSON( json_str, file, method = "C", unexpected.escape = "error", simplify = TRUE )</pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>json_str</code></td> <td> <p>a JSON object to convert</p> </td></tr> <tr valign="top"><td><code>file</code></td> <td> <p>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.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>use the <code>C</code> implementation, or the older slower (and one day to be depricated) <code>R</code> implementation</p> </td></tr> <tr valign="top"><td><code>unexpected.escape</code></td> <td> <p>changed handling of unexpected escaped characters. Handling value should be one of "error", "skip", or "keep"; on unexpected characters issue an <code>error</code>, <code>skip</code> the character, or <code>keep</code> the character</p> </td></tr> <tr valign="top"><td><code>simplify</code></td> <td> <p>If TRUE, attempt to convert json-encoded lists into vectors where appropriate. If FALSE, all json-encoded lists will be wrapped in a list even if they are all of the same data type. </p> </td></tr> </table> <h3>Value</h3> <p>R object that corresponds to the JSON object</p> <h3>See Also</h3> <p><code><a href="toJSON.html">toJSON</a></code> </p> <h3>Examples</h3> <pre> fromJSON('[1,2,3]', simplify=TRUE) # returns c(1,2,3) fromJSON('[1,2,3]', simplify=FALSE) # returns list(1,2,3) #As a result, this will output "1" toJSON(fromJSON('[1]', simplify=TRUE)) #Compared with this which will output "[1]" as expected toJSON(fromJSON('[1]', simplify=TRUE)) #R vs C execution time x <- toJSON( iris ) system.time( y <- fromJSON(x) ) system.time( y2 <- fromJSON(x,method = "R") ) </pre> <hr /><div style="text-align: center;">[Package <em>rjson</em> version 0.2.20 <a href="00Index.html">Index</a>]</div> </body></html>