json_mutate: Update values

Description Usage Arguments Value Examples

View source: R/modify.R

Description

Update values

Usage

1

Arguments

x

A JSON vector.

...

Name-value pairs. The name is the JSON path (without leading "$").

Value

A json2 vector similar to x with the components modified as specified in ....

Examples

1
2
3
4
5
6
7
8
9
x_na <- c('{"a": 11, "b": {"x": 12}}', NA, '{"a": 21, "b": {"x": 22}}')
# update with different values
json_mutate(x_na, .a = 1:3)

# NA is translated to null
json_mutate(x_na, .a = 1:3, .b.x = NA)

# create new keys
json_mutate(x_na, .c = 0, .d.x = c("a", "b", "c"))

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