ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - TomWright/dasel: Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package.
Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package. - TomWright/dasel
Visit Site

GitHub - TomWright/dasel: Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package.

GitHub - TomWright/dasel: Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package.

dasel

Gitbook Go Report Card PkgGoDev Test Build codecov Mentioned in Awesome Go GitHub All Releases Downloads GitHub License GitHub tag (latest by date) Homebrew tag (latest by date)

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 all

Say 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.

Update Kubernetes Manifest

# 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()'

Table of contents

Quickstart

Dasel is available on homebrew, ASDF, scoop, docker, Nix or as compiled binaries from the latest release.

brew install dasel

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.

Select

echo '{"name": "Tom"}' | dasel -r json 'name'
"Tom"

See select documentation.

Convert json to yaml

echo '{"name": "Tom"}' | dasel -r json -w yaml
name: Tom

See select documentation.

Put

echo '{"name": "Tom"}' | dasel put -r json -t string -v '[email protected]' 'email'
{
  "email": "[email protected]",
  "name": "Tom"
}

See put documentation.

Delete

echo '{
  "email": "[email protected]",
  "name": "Tom"
}' | dasel delete -r json '.email'
{
  "name": "Tom"
}

See delete documentation.

Completion

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

Pre-Commit

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 images
  • dasel-validate-bin pre-commit hook for executing dasel using the official binary

Issue vs Discussion

I 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:

  • You find a bug.
  • You have a feature request and can clearly describe your request.

Please open a discussion if:

  • You have a question.
  • You're not sure how to achieve something with dasel.
  • You have an idea but don't quite know how you would like it to work.
  • You have achieved something cool with dasel and want to show it off.
  • Anything else!

Features

Documentation

The official dasel docs can be found at daseldocs.tomwright.me.

Playground

You can test out dasel commands using the playground.

Source code for the playground can be found at github.com/TomWright/daselplayground.

Benchmarks

In my tests dasel has been up to 3x faster than jq and 15x faster than yq.

See the benchmark directory.

Stargazers over time

Stargazers over time

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory