ConfigsJul 5, 2026·3 min read

Dasel — Query and Modify JSON, YAML, TOML, XML, and CSV from the CLI

Dasel is a command-line tool for querying and updating data structures across multiple formats including JSON, YAML, TOML, XML, INI, HCL, KDL, and CSV using a unified selector syntax.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 29/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
CLI Tool
Install
Single
Trust
Trust: Established
Entrypoint
Dasel Overview
Safe staging command
npx -y tokrepo@latest install 4b6edef1-784d-11f1-9bc6-00163e2b0d79 --target codex

Stages files first; activation requires review of the staged README and plan.

Introduction

Dasel (Data Selector) provides a single tool for reading, writing, and converting between structured data formats. Instead of learning separate query languages for jq, yq, xmlstarlet, and others, you use one selector syntax that works the same way across all supported formats.

What Dasel Does

  • Reads and writes JSON, YAML, TOML, XML, CSV, INI, HCL, and KDL files
  • Selects nested values using dot-notation and array index selectors
  • Modifies values in place with put commands
  • Converts between formats by specifying different read and write parsers
  • Supports piping from stdin and writing to stdout for shell integration

Architecture Overview

Dasel parses input into an internal tree representation regardless of the source format. Selectors navigate this tree to locate target nodes. Modifications update the tree in memory, then the output formatter serializes the tree back to the requested format. This design means all features work identically across all supported data formats.

Self-Hosting & Configuration

  • Install via go install, Homebrew, Scoop, or download release binaries
  • No configuration files; all options are passed as command-line arguments
  • Use -r flag to specify input format and -w flag for output format
  • Pipe data through stdin or pass file paths as arguments
  • Chain multiple selectors for deep nested access

Key Features

  • Unified selector syntax across eight data formats
  • In-place file editing with the -w flag pointing to the same file
  • Format conversion in a single command
  • Support for array filtering, dynamic selectors, and wildcards
  • Zero external dependencies as a single compiled binary

Comparison with Similar Tools

  • jq — JSON-only, more powerful query language but limited to one format
  • yq — Focuses on YAML with JSON support, different selector syntax
  • xq — XML wrapper around jq, does not support YAML or TOML
  • Miller — Excels at tabular data (CSV/TSV) but limited structured data support

FAQ

Q: Can dasel modify files in place? A: Yes. Use dasel put -r json -w json -f config.json 'key' -v 'value' to update a key directly in the file.

Q: How do I select array elements? A: Use bracket notation: dasel -r json 'users.[0].name' selects the name of the first user.

Q: Does dasel preserve comments in YAML? A: No. Comments are not part of the data model and are dropped during parsing, which is a limitation shared with most programmatic YAML tools.

Q: Can I use dasel in CI/CD pipelines? A: Yes. It is a single binary with no dependencies, making it easy to add to Docker images or CI runners.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets