json_path_exists: Does the path exist?

Description Usage Arguments Value Examples

View source: R/json_path.R

Description

Does the path exist?

Usage

1

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 logical vector.

Examples

1
2
3
4
5
6
7
8
9
json_path_exists(
  c(
    '{"a": 1}',
    '{"b": 2}',
    "[1, 2]",
    NA_character_
  ),
  "$.a"
)

jsontools documentation built on March 22, 2021, 5:06 p.m.