Supported file types
Dasel attempts to find the correct parser for the given file type, but if that fails you can choose which parser to use with the -p
or --parser
flag.
JSON
Using golang.org/pkg/encoding/json.
Multi-document files
Multi-document files are decoded into an array, with [0]
being the first document, [1]
being the second and so on.
Once decoded, you can access them using any of the standard selectors provided by Dasel.
TOML
Using github.com/pelletier/go-toml.
YAML
Using gopkg.in/yaml.v2.
Multi-document files
Multi-document files are decoded into an array, with [0]
being the first document, [1]
being the second and so on.
Once decoded, you can access them using any of the standard selectors provided by Dasel.
XML
Using github.com/clbanning/mxj.
Data Format
XML documents within dasel are stored as a map of values.
This is just how dasel stores data and is required for the general functionality to work. An example of a simple documents representation is as follows:
In general this won't affect you, but on the odd occasion in specific instances it could lead to unexpected output.
If you are struggling with this please open a discussion for support. This will also help me know when the docs aren't sufficient.
Debugging
You can run select commands with the --plain
flag to see the raw data that is stored within dasel. This can help you figure out the exact properties you may need to target when it isn't immediately obvious.
Arrays/Lists
Due to the way that XML is decoded, dasel can only detect something as a list if there are at least 2 items.
If you try to use list selectors (dynamic, index, append) when there are less than 2 items in the list you will get an error.
There are no plans to introduce a workaround for this but if there is enough demand it may be worked on in the future.
CSV
Using golang.org/pkg/encoding/csv.
Adding data
New columns will be detected and added to the end of the CSV output.
Column deletion is not supported.
Plain
This outputs the data using fmt.Sprint(x)
, displaying whatever underlying value is present as a string.
Last updated