json_path_exists: Does the path exist?

View source: R/json_path.R

json_path_existsR Documentation

Does the path exist?

Description

Does the path exist?

Usage

json_path_exists(x, path)

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

json_path_exists(
  c(
    '{"a": 1}',
    '{"b": 2}',
    "[1, 2]",
    NA_character_
  ),
  "$.a"
)

mgirlich/jsontools documentation built on March 21, 2023, 9:10 a.m.