jsonElemAt_ifString: Extract a string from a JSON array

Description Usage Arguments Value See Also Examples

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

Description

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

Usage

1
jsonElemAt_ifString(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
json <- "[1,\"hello\",null,\"bird\"]"
jsonElemAt_ifString(json, 1)
jsonElemAt_ifString(json, 0) == "null"

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