Unified querying, transformation, and modification of JSON, TOML, YAML, XML, INI, HCL, KDL and CSV.
Unified querying, transformation, and modification of JSON, TOML, YAML, XML, INI, HCL, KDL and CSV.
Dasel (short for Data-Select) is a command-line tool and library for querying, modifying, and transforming data structures such as JSON, YAML, TOML, XML, CSV, and KDL.
It provides a consistent, powerful syntax to traverse and update data — making it useful for developers, DevOps, and data wrangling tasks.
brew install daselgo install github.com/tomwright/dasel/v3/cmd/dasel@masterPrebuilt binaries are available on the Releases page for Linux, macOS, and Windows.
See the installation docs for more options.
Dasel supports tab-completion for Bash, Zsh, Fish, and PowerShell. Generate and load the completion script for your shell:
# Bash
source <(dasel completion bash)
# Zsh
source <(dasel completion zsh)
# Fish
dasel completion fish | source
# PowerShell
dasel completion powershell | Out-String | Invoke-ExpressionSee the shell completion docs for permanent installation instructions.
Generate and view the man page:
dasel man | man -l -By default, Dasel evaluates the final selector and prints the result.
echo '{"foo": {"bar": "baz"}}' | dasel -i json 'foo.bar'
# Output: "baz"Update values inline:
echo '{"foo": {"bar": "baz"}}' | dasel -i json 'foo.bar = "bong"'
# Output: "bong"Use --root to output the full document after modification:
echo '{"foo": {"bar": "baz"}}' | dasel -i json --root 'foo.bar = "bong"'
# Output:
{
"foo": {
"bar": "bong"
}
}Update values based on previous value:
echo '[1,2,3,4,5]' | dasel -i json --root 'each($this = $this*2)'
# Output:
[
2,
4,
6,
8,
10
]cat data.json | dasel -i json -o yaml..)Searches all nested objects and arrays for a matching key or index.
echo '{"foo": {"bar": "baz"}}' | dasel -i json '..bar'
# Output:
[
"baz"
]
search)Finds all values matching a condition anywhere in the structure.
echo '{"foo": {"bar": "baz"}}' | dasel -i json 'search(bar == "baz")'
# Output:
[
{
"bar": "baz"
}
]
Full documentation is available at daseldocs.tomwright.me.
Contributions are welcome! Please see the CONTRIBUTING.md for details.
MIT License. See LICENSE for details.
Even more installation packages
> escaped in TOML in JSON output
manual installation for aarch64 linux
Avoid string type quote stripping in yaml
[V3] Directory Loading and Begin Implementing Lazy-Loading
YAML anchors, aliases and references
HTML support
Emoji is changed to Unicode in yaml
Preserve comments when editing files
Square brackets syntax in yaml