The R Project SVN R-packages

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7747 ripley 1
\name{basicJSONHandler}
2
\alias{basicJSONHandler}
3
\title{Create handler for processing JSON elements from a parser}
4
\description{
5
 This function creates a handler object that is used to 
6
 consume tokens/elements from a JSON parser and combine
7
 them into R objects.
8
 
9
 This is  slow relative to using C code because  this is done
10
 in R and also we don't know the length of each object until
11
 we have consumed all its elements. 
12
}
13
\usage{
14
basicJSONHandler(default.size = 100, simplify = FALSE)
15
}
16
\arguments{
17
  \item{default.size}{the best guess as to the sizes of the different elements. This is used
18
   for preallocating space for elements}
19
  \item{simplify}{a logical value indicating whether to simplify arrays
20
   from lists to vectors if the elements are of compatible types.}
21
}
22
\value{
23
  \item{update}{a function called with a JSON element and used to process that element and add it to the relevant R object}
24
  \item{value}{a function to retrieve the result after  processing the JSON}
25
}
26
%\references{}
27
\author{
28
Duncan Temple Lang
29
}
30
 
31
\seealso{
32
 \code{\link{fromJSON}} and the handler argument.
33
}
34
\examples{
35
  h = basicJSONHandler()
36
  x = fromJSON("[1, 2, 3]", h)
37
  x
38
  h$value()
39
}
40
\keyword{IO}	
41
\keyword{programming}