EVOLUTION-MANAGER
Edit File: newJSONParser.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 buffered JSON objects 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 newJSONParser {rjson}"><tr><td>newJSONParser {rjson}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Convert buffered JSON objects To R </h2> <h3>Description</h3> <p> Convert a collection of JSON objects into R objects. </p> <h3>Usage</h3> <pre>newJSONParser(method = "R")</pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>method</code></td> <td> <p>use the <code>C</code> implementation, or the slower original <code>R</code> implementation</p> </td></tr> </table> <h3>Value</h3> <p>A list of functions used for parsing objects</p> <h3>See Also</h3> <p><code><a href="toJSON.html">toJSON</a></code> </p> <h3>Examples</h3> <pre> sample_json <- ' { "breakfast" : [ "milk", "fruit loops", "juice" ], "lunch" : [ "left over sushi" ] } ' parser <- newJSONParser() parser$addData( sample_json ) food <- parser$getObject() print( food ) #This is equivalent to using FromJSON( sample_json ) #However, sample_json can be split into several parts: ### EXAMPLE 2: part_1 <- '{ "breakfast" : [ "milk", "fruit loops", "juice" ], ' part_2 <- '"lunch" : [ "left over sushi" ]' # close off the first object, and create a 2nd JSON object, which is simply an # array part_3 <- '} [1,2,3,4,5]' parser <- newJSONParser() parser$addData( part_1 ) parser$getObject() #returns NULL - since part_1 isn't complete parser$addData( part_2 ) parser$getObject() #returns NULL - since part_2 still isn't complete parser$addData( part_3 ) parser$getObject() #returns the first food object parser$getObject() #returns the second array </pre> <hr /><div style="text-align: center;">[Package <em>rjson</em> version 0.2.20 <a href="00Index.html">Index</a>]</div> </body></html>