dasel
TLDR
Query a value from a JSON file
SYNOPSIS
dasel [command] [flags] [selector]
dasel select [-f file] [-p parser] [-w writer] selector
dasel put [-f file] [-t type] [-v value] selector
dasel delete [-f file] selector
DESCRIPTION
dasel (Data Selector) is a command-line tool for querying and modifying structured data files. It provides a unified interface for working with JSON, YAML, TOML, XML, CSV, INI, and HCL formats using a consistent selector syntax.
The tool supports three main operations: select for querying data, put for modifying or adding values, and delete for removing keys. Selectors use dot notation for nested access (e.g., `.database.host`) and bracket notation for array indices (e.g., `.users.[0].name`).
Dasel can convert between formats by specifying different input and output parsers, making it useful for configuration file transformations. It reads from files or stdin and writes to files or stdout, integrating well with shell pipelines.
PARAMETERS
-f, --file PATH
Input file path; reads from stdin if omitted-p, --parser FORMAT
Parser for input data (json, yaml, toml, xml, csv, ini, hcl); auto-detected from file extension-w, --write FORMAT
Output format; defaults to input parser type-t, --type TYPE
Value type for put command (string, int, bool, json)-v, --value VALUE
Value to set with put command-o, --out FILE
Output file path; writes to stdout if omitted-r, --read FORMAT
Alias for --parser--pretty
Pretty-print output for readability-c, --compact
Compact output without formatting-m, --multiple
Select multiple values matching the selector-n, --null
Output null values explicitly--colour, --color
Enable colored output--escape-html
Escape HTML entities in output-h, --help
Display help information-v, --version
Display version information
CAVEATS
Comments in YAML and TOML files are discarded when writing due to parser limitations. The entire document is loaded into memory, so very large files may cause high memory usage. Array indices are zero-based. When modifying files, the original formatting may not be preserved exactly.
HISTORY
Dasel was created by Tom Wright and first released in 2020. Written in Go, it was designed as a universal alternative to format-specific tools like jq (JSON), yq (YAML), and xmlstarlet (XML). The name is a portmanteau of "data" and "select". It gained popularity for its ability to use identical selector syntax across multiple data formats and its single-binary distribution with no dependencies.
SEE ALSO
jq(1), yq(1), xmlstarlet(1), mlr(1)


