jsonElemAt: Extract element of a JSON array

Description Usage Arguments Value See Also Examples

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

Description

Returns the element of a JSON array by giving the desired index.

Usage

1
jsonElemAt(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

jsonElemsAt, jsonElemAt_ifNumber, jsonAccess

Examples

1
2
3
4
5
6
json <- "[0,1,\"hello\",null,\"bird\"]"
jsonElemAt(json, 2)
jsonElemAt(json, 3)
jsonElemAt(json, 10) == "null"
jsonElemsAt(json, 1:4) %>% jsonElemAt(3)
jsonElemAt("{\"a\":{\"b\":8}}", 0) == "null"

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