json_array_length: Get array length of JSON arrays

Description Usage Arguments Value Examples

View source: R/array_utils.R

Description

Get array length of JSON arrays

Usage

1
json_array_length(x, wrap_scalars = FALSE)

Arguments

x

A JSON vector.

wrap_scalars

Consider scalars as length one array?

Value

An integer vector of array lengths.

Examples

1
2
3
4
json_array_length(c(NA, "[1, 2, 3]", "[1, 2]"))

# scalars produce an error unless `wrap_scalars` is `TRUE`
json_array_length(1, wrap_scalars = TRUE)

jsontools documentation built on March 22, 2021, 5:06 p.m.