json_delete: Remove JSON element

View source: R/delete.R

json_deleteR Documentation

Remove JSON element

Description

Remote the elements at the specified paths from a JSON vector.

Usage

json_delete(x, ...)

Arguments

x

A JSON vector.

...

Paths to delete.

Value

A json2 vector similar to x with the specified paths removed from it.

Examples

x <- c('{"a": 11, "b": {"x": 12}}', NA)

json_delete(x, "$.a")
# remove from multiple paths at once
json_delete(x, "$.a", "$.b")
# remove at a nested path
json_delete(x, "$.b.x")

# non-existing elements are just ignored
json_delete(x, "$.abc")

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