Learn R Programming

jsontools (version 0.1.0)

json_type: Query the JSON type

Description

The JSON types are

  • null

  • true, false

  • integer

  • real

  • array

  • object

Usage

json_type(x, path = NULL)

Arguments

x

A JSON vector

path

Path to element. This must be a valid JSONpath expression. For example "$.a.b[0] extracts the 1 in {"a": {"b": [1, 2]}}.

Value

A character vector of JSON types

Examples

Run this code
# NOT RUN {
json_type(c(NA, "1", "null", "[1,2]", '{"a": 1}'))
# }

Run the code above in your browser using DataLab