Set value at existing path
Consider the example input YAML file:
To set a value in a document, the key needs be to a path, along with a value.
This will set the pswd
value to **********
and print the whole document with new value to the command line.
Note
If the --output
option in obj
is used to output to a file, the result is not printed to screen.
For example, the following will output to a file:
cat conf.yaml | rickle --output-type JSON obj --output conf.json set /root_node/level_one/pswd *********
conf.json | |
---|---|
Of course this could also be directed:
Note
Values can only be set for paths that exist. To create a new path, use put
.
This will, however, not work in the following example and result in an error:
Which results in the error message:
Troubleshooting
The most likely problem to occur is if the path can not be traversed, i.e. the path is incorrect: