Learn R Programming

jsontools (version 0.1.0)

json_array_length: Get array length of JSON arrays

Description

Get array length of JSON arrays

Usage

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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab