Description Usage Arguments Value Examples
Update values
1 | json_mutate(x, ...)
|
x |
A JSON vector. |
... |
Name-value pairs. The name is the JSON path (without leading "$"). |
A json2
vector similar to x
with the components modified as
specified in ...
.
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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.