Dasel (short for data-selector) allows you to query and modify data structures using selector strings.
Comparable to jq / yq, but supports JSON, YAML, TOML, XML and CSV with zero runtime dependencies.
One tool to rule them allSay good bye to learning new tools just to work with a different data format.
Dasel uses a standard selector syntax no matter the data format. This means that once you learn how to use dasel you immediately have the ability to query/modify any of the supported data types without any additional tools or effort.
Commands executed in the demo# Piping data into dasel echo '{"demo": "Integrating with github releases..."}' | dasel -r json 'demo' # Fetch dasel releases from github api curl -L \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/TomWright/dasel/releases > releases.json less releases.json # Extract and structure release data by version with download URL's by asset name dasel -f releases.json -w yaml 'all().mapOf(version,tag_name,download,assets.all().mapOf(name,name,url,browser_download_url).merge()).merge()' > releases_download.yaml less releases_download.yaml # Restructure the above data into CSV format, destructuring into rows. dasel -f releases_download.yaml -w csv 'all().download.all().mapOf(version,parent(2).version,name,name,url,url).merge()' > releases_download.csv less releases_download.csv # Fetch the first CSV row and output as JSON dasel -f releases_download.csv -w json 'first()'
Dasel is available on homebrew, ASDF, scoop, docker, Nix or as compiled binaries from the latest release.
You can also install a development version with:
go install github.com/tomwright/dasel/v2/cmd/dasel@master
For more information see the installation documentation.
echo '{"name": "Tom"}' | dasel -r json 'name' "Tom"
See select documentation.
echo '{"name": "Tom"}' | dasel -r json -w yaml name: Tom
See select documentation.
echo '{"name": "Tom"}' | dasel put -r json -t string -v 'contact@tomwright.me' 'email' { "email": "contact@tomwright.me", "name": "Tom" }
See put documentation.
echo '{ "email": "contact@tomwright.me", "name": "Tom" }' | dasel delete -r json '.email' { "name": "Tom" }
See delete documentation.
If you want to use completion from the terminal you can do the following (using zsh in this example):
Add the following to ~/.zshrc
and reload your terminal.
export fpath=(~/zsh/site-functions $fpath) mkdir -p ~/zsh/site-functions dasel completion zsh > ~/zsh/site-functions/_dasel compinit
Add dasel
hooks to .pre-commit-config.yaml
file
- repo: https://github.com/TomWright/dasel rev: v1.25.1 hooks: - id: dasel-validate
for a native execution of dasel, or use:
dasel-validate-docker
pre-commit hook for executing dasel using the official Docker imagesdasel-validate-bin
pre-commit hook for executing dasel using the official binaryI have enabled discussions on this repository.
I am aware there may be some confusion when deciding where you should communicate when reporting issues, asking questions or raising feature requests so this section aims to help us align on that.
Please raise an issue if:
Please open a discussion if:
The official dasel docs can be found at daseldocs.tomwright.me.
You can test out dasel commands using the playground.
Source code for the playground can be found at github.com/TomWright/daselplayground.
In my tests dasel has been up to 3x faster than jq and 15x faster than yq.
See the benchmark directory.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4