Create named list of options for parsing R from JSON

from_opts(
  int64 = c("string", "bit64"),
  missing_list_elem = c("null", "na"),
  vectors_to_df = TRUE,
  str_specials = c("string", "special"),
  num_specials = c("special", "string"),
  promote_num_to_string = FALSE,
  yyjson_read_flag = 0L
)

Arguments

int64

how to encode large integers which do not fit into R's integer type. 'string' imports them as a character vector. 'bit64' will use the 'integer64' type from the 'bit64' package. Note that the 'integer64' type is a signed integer type, and a warning will be issued if JSON contains an unsigned integer which cannot be stored in this type.

missing_list_elem

how to handle missing elements in list columns in data.frames. Options, 'na', or 'null. Default: 'null'

vectors_to_df

logical. Should a named list of equal-length vectors be promoted to a data.frame? Default: TRUE. If FALSE, then result will be left as a list.

str_specials

Should 'NA' in a JSON string be converted to the 'special' NA value in R, or left as a 'string'. Default: 'string'

num_specials

Should jsong strings 'NA'/'Inf'/'NaN' in a numeric context be converted to the 'special' R numeric values NA, Inf, NaN, or left as a 'string'. Default: 'special'

promote_num_to_string

Should numeric values be promoted to strings when they occur within an array with other string values? Default: FALSE means to keep numerics as numeric value and promote the container to be a list rather than an atomic vector when types are mixed. If TRUE then array of mixed string/numeric types will be promoted to all string values and returned as an atonic character vector. Set this to TRUE if you want to emulate the behaviour of jsonlite::fromJSON()

yyjson_read_flag

integer vector of internal yyjson options. See read_flag in this package, and read the yyjson API documentation for more information. This is considered an advanced option.

Value

Named list of options

See also