basicJSONHandler.RdThis function creates a handler object that is used to consume tokens/elements from a JSON parser and combine them into R objects.
This is slow relative to using C code because this is done in R and also we don't know the length of each object until we have consumed all its elements.
basicJSONHandler(default.size = 100, simplify = FALSE)a function called with a JSON element and used to process that element and add it to the relevant R object
a function to retrieve the result after processing the JSON
fromJSON and the handler argument.
h = basicJSONHandler()
x = fromJSON("[1, 2, 3]", h)
x
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 2
#>
#> [[3]]
#> [1] 3
#>
h$value()
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 2
#>
#> [[3]]
#> [1] 3
#>