jsonElemAt_ifObject: Extract an object from a JSON array

Description Usage Arguments Value See Also Examples

Description

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

Usage

1
jsonElemAt_ifObject(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,0,{},null,\"bird\"]"
jsonElemAt_ifObject(json, 2)
jsonElemAt_ifObject(json, 1) == "null"
jsonElemAt_ifObject(json, 3)

stla/jsonAccess documentation built on May 30, 2019, 5:47 p.m.