MCPcopy
hub / github.com/TomWright/dasel

github.com/TomWright/dasel @v3.11.2 sqlite

repository ↗ · DeepWiki ↗ · release v3.11.2 ↗
1,164 symbols 6,537 edges 272 files 264 documented · 23%
README

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

<img src="https://github.com/TomWright/dasel/raw/v3.11.2/daselgopher.png" alt="Dasel mascot" width="250"/>

Dasel

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.


Features

  • Multi-format support: JSON, YAML, TOML, XML, CSV, HCL, INI, KDL.
  • Unified query syntax: Access data in any format with the same selectors.
  • Query & search: Extract values, lists, or structures with intuitive syntax.
  • Modify in place: Update, insert, or delete values directly in structured files.
  • Convert between formats: Seamlessly transform data from JSON → YAML, TOML → JSON, etc.
  • Script-friendly: Simple CLI integration for shell scripts and pipelines.
  • Library support: Import and use in Go projects.

Installation

Homebrew (macOS/Linux)

brew install dasel

Go Install

go install github.com/tomwright/dasel/v3/cmd/dasel@master

Prebuilt Binaries

Prebuilt binaries are available on the Releases page for Linux, macOS, and Windows.

None of the above?

See the installation docs for more options.


Shell Completion

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-Expression

See the shell completion docs for permanent installation instructions.

Man Page

Generate and view the man page:

dasel man | man -l -

Basic Usage

Selecting Values

By default, Dasel evaluates the final selector and prints the result.

echo '{"foo": {"bar": "baz"}}' | dasel -i json 'foo.bar'
# Output: "baz"

Modifying Values

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
]

Format Conversion

cat data.json | dasel -i json -o yaml

Recursive Descent (..)

Searches all nested objects and arrays for a matching key or index.

echo '{"foo": {"bar": "baz"}}' | dasel -i json '..bar'
# Output:
[
    "baz"
]

Search (search)

Finds all values matching a condition anywhere in the structure.

echo '{"foo": {"bar": "baz"}}' | dasel -i json 'search(bar == "baz")'
# Output:
[
    {
        "bar": "baz"
    }
]


Documentation

Full documentation is available at daseldocs.tomwright.me.


Contributing

Contributions are welcome! Please see the CONTRIBUTING.md for details.


License

MIT License. See LICENSE for details.

Stargazers over time

Stargazers over time

Extension points exported contracts — how you extend this code

Reader (Interface)
Reader reads a value from a byte slice. [9 implementers]
parsing/reader.go
Writer (Interface)
Writer writes a value to a byte slice. [9 implementers]
parsing/writer.go
Expr (Interface)
(no doc) [33 implementers]
selector/ast/ast.go
ExecuteOptionFn (FuncType)
ExecuteOptionFn is a function that can be used to set options on the execution of the selector.
execution/options.go
ArgsValidator (FuncType)
ArgsValidator is a function that validates the arguments passed to a function.
execution/func.go
NewReaderFn (FuncType)
NewReaderFn is a function that creates a new reader.
parsing/reader.go
DocumentSeparator (Interface)
DocumentSeparator is an interface that can be implemented by writers to allow for custom document separators. [1 implementers]
parsing/writer.go
FuncFn (FuncType)
FuncFn is a function that can be executed.
execution/func.go

Core symbols most depended-on inside this repo

Run
called by 1155
internal/cli/man.go
NewIntValue
called by 525
model/value_literal.go
NewStringValue
called by 421
model/value_literal.go
Append
called by 376
model/value_slice.go
SetMapKey
called by 344
model/value_map.go
NewMapValue
called by 217
model/value_map.go
NewSliceValue
called by 197
model/value_slice.go
NewFloatValue
called by 186
model/value_literal.go

Shape

Function 719
Method 290
Struct 129
TypeAlias 13
FuncType 9
Interface 4

Languages

Go100%

Modules by API surface

parsing/kdl/internal/spec_v2_test.go114 symbols
selector/ast/expression_complex.go57 symbols
parsing/kdl/internal/tokenizer_test.go39 symbols
parsing/kdl/internal/tokenizer.go34 symbols
parsing/kdl/internal/spec_v1_test.go30 symbols
parsing/kdl/cross_format_test.go29 symbols
model/value.go26 symbols
parsing/kdl/internal/conversion_test.go23 symbols
model/value_literal.go22 symbols
parsing/kdl/internal/parser_test.go21 symbols
model/value_test.go19 symbols
parsing/kdl/internal/generator_test.go18 symbols

Dependencies from manifests, versioned

github.com/agext/levenshteinv1.2.1 · 1×
github.com/apparentlymart/go-textseg/v15v15.0.0 · 1×
github.com/atotto/clipboardv0.1.4 · 1×
github.com/aymanbagabas/go-osc52/v2v2.0.1 · 1×
github.com/charmbracelet/bubblesv1.0.0 · 1×
github.com/charmbracelet/colorprofilev0.4.1 · 1×
github.com/charmbracelet/lipglossv1.1.0 · 1×
github.com/charmbracelet/x/ansiv0.11.6 · 1×
github.com/charmbracelet/x/cellbufv0.0.15 · 1×
github.com/charmbracelet/x/termv0.2.2 · 1×

For agents

$ claude mcp add dasel \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact