Put object

Description

This command allows you to modify data at a given selector.
It generally works in the same way as put, but allows you to write entire maps with a single command.
Note that put object will completely overwrite any existing data at the given selector.

Usage

1
dasel put object -f <file> -t <type> -t <type> <selector> <value:key=value> <value:key=value>
Copied!
Omit the types and values to create an empty object/map.
Flag
Description
-t, <type>
The type of value you want to put.
You must repeat this argument for each value provided.
Available arguments:
    string
    int
    bool
<value>
The key + value to write askey=value
Dasel will parse this value as a string, int, or bool depending on the given type.
This is required.
-f, --file
Specify the file to query. This is required unless you are piping in data.
If piping in data you can optionally pass -f stdin/-f -.
-o, --out
Specify the output file. If present, results will be written to the given file. If not present, results will be written to the input file (or stdout if none given).
To force output to be written to stdout, pass -o stdoutor-o -.
-r, --read
Specify the parser to use when reading the input data.
This is required if you are piping in data, otherwise dasel will use the given file extension to guess which parser to use.
-w, --write
Specify the parser to use when writing the output data.
If not provided dasel will attempt to use the --out and --read flags to determine which parser to use.
-p, --parser
Shorthand for -r <value> -w <value>
-m, --multiple
Tells dasel to put multiple items.
-s, --selector, <selector>
Specify the selector to use. See selectors for more information.
If no selector flag is given, dasel assumes the first argument given is the selector.
This is required.
--plain
By default, dasel formats the output using the specified parser.
If this flag is used no formatting occurs and the results output as a string.
-c, --compact
This tells dasel to output compact data where possible. E.g. not pretty printing JSON.
--merge-input-documents
--escape-html

Example

Put object

1
echo "" |
2
dasel put object -p yaml -t string -t int "my.favourites" colour=red number=3
Copied!
Results in the following:
1
my:
2
favourites:
3
colour: red
4
number: 3
Copied!
Last modified 25d ago