jsonElemAt_ifArray: Extract an array from a JSON array

Description Usage Arguments Value See Also Examples

View source: R/jsonAccess.R View source: R/jsonAccess.R

Description

Returns the array in a JSON array by giving its index; returns "null" if there is no array at this index.

Usage

1
jsonElemAt_ifArray(json, index, toJSON = FALSE, fromJSON = FALSE)

Arguments

json

JSON string

index

integer

toJSON

logical, whether to apply toJSON to the input

fromJSON

logical, whether to apply fromJSON to the output

Value

A JSON string if fromJSON=FALSE, a R object if fromJSON=TRUE.

See Also

jsonElemAt, jsonAccess

Examples

1
2
3
4
json <- "[1,[{},2],null,\"bird\"]"
jsonElemAt_ifArray(json, 2)
jsonElemAt_ifArray(json, 1) == "null"
jsonElemAt_ifArray(json, 3)

stla/jsonAccess documentation built on May 26, 2017, 9 p.m.