simplify_homogeneous_lists: Fix jsonlite's JSON simplification.

Description Usage Arguments Value Note Examples

View source: R/utils.r

Description

Fix jsonlite's JSON simplification.

Usage

1
simplify_homogeneous_lists(object, simple_check = TRUE)

Arguments

object

any R object derived from fromJSON.

simple_check

logical. This is needed to modify behavior for recursive function call.

Value

the same object, with any list components where each element is an atomic vector of length 1 or NULL coerced to a single atomic vector.

Note

See https://github.com/jeroenooms/jsonlite/issues/66 for more details.

Examples

1
2
3
4
5
6
7
8
## Not run: 
  simplify_homogeneous_lists(jsonlite::fromJSON(
   '{ "numeric": [1,2], "list": [1, "a"] }', simplifyVector = FALSE))
  # A list with atomic numeric vector in the "numeric" key and
  # a list in the "list" key.
  # list(numeric = c(1,2), list = list(1, "a"))

## End(Not run)

robertzk/microserver documentation built on May 27, 2019, 10:34 a.m.