Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 5, 2026·3 min de lecture

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.

Prêt pour agents

Staging sûr pour cet actif

Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.

Stage only · 29/100Policy : staging
Surface agent
Tout agent MCP/CLI
Type
CLI Tool
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Dasel Overview
Commande de staging sûr
npx -y tokrepo@latest install 4b6edef1-784d-11f1-9bc6-00163e2b0d79 --target codex

Stage les fichiers d'abord; l'activation exige la revue du README et du plan staged.

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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires