YAML JSON Query
Query and edit YAML, JSON, XML, TOML and INI with yq expressions and apply RFC 6902 JSON Patch, keeping comments.
Install
irm https://raw.githubusercontent.com/chayprabs/localtools/main/yaml-json-query/install.ps1 | iexlocaltools-yaml-json-query updatelocaltools-yaml-json-query uninstall
curl -fsSL https://raw.githubusercontent.com/chayprabs/localtools/main/yaml-json-query/install.sh | bashlocaltools-yaml-json-query updatelocaltools-yaml-json-query uninstall
brew install chayprabs/localtools/localtools-yaml-json-querybrew upgrade localtools-yaml-json-querybrew uninstall localtools-yaml-json-query
scoop bucket add localtools https://github.com/chayprabs/homebrew-localtools; scoop install localtools-yaml-json-queryscoop update localtools-yaml-json-queryscoop uninstall localtools-yaml-json-query
winget install localtools.YamlJsonQuerywinget upgrade localtools.YamlJsonQuerywinget uninstall localtools.YamlJsonQuery
Opens at http://127.0.0.1:47110 in your browser. Run localtools-yaml-json-query --help for the command line. Set LOCALTOOLS_NO_OPEN=1 to install without opening it.
Direct download
| Platform | File | Size |
|---|---|---|
| Linux ARM64 | yaml-json-query-1.0.4-linux-arm64.zip | 5.9 MB |
| Linux x64 | yaml-json-query-1.0.4-linux-x64.zip | 6.5 MB |
| macOS Apple Silicon | yaml-json-query-1.0.4-macos-arm64.zip | 6.0 MB |
| macOS Intel | yaml-json-query-1.0.4-macos-x64.zip | 6.5 MB |
| Windows x64 | yaml-json-query-1.0.4-windows-x64.zip | 6.6 MB |
SHA-256 checksums are in the release notes; the install scripts verify them for you.
See it
How to use
- Paste YAML, JSON, TOML, XML, INI, CSV or .properties, or drop the file.
- Query mode: write a yq expression such as .spec.template.spec.containers[].image, or .version = "2.0" to edit. Use . with another output format to convert.
- Patch mode: paste an RFC 6902 JSON Patch (array) or an RFC 7386 merge patch (object).
- Press Run (Ctrl+Enter); copy or download the result. From a terminal: localtools-yaml-json-query eval|convert|patch.
FAQ
Are YAML comments kept when I edit or patch a file?
Yes. Expressions and patches work on yq's node tree, so comments, anchors, aliases, quoting and key order survive. Blank lines are not preserved (a yq limitation).
Which query syntax does it use?
yq's jq-style syntax by default (select, map, del, with_entries, multi-document selection and more). JMESPath is also available for read-only queries.
Why does a patch refuse to change a path under an alias?
The value is shared through a YAML anchor; changing it there would silently change every other place that uses the anchor. Patch the anchor itself instead.
How do I patch the second document of a multi-document YAML file?
Set the YAML document number to 1 in the UI, or pass --doc 1 on the command line. The other documents are written back unchanged.
Does my data leave my computer?
No. Everything runs in the local executable on 127.0.0.1; the page loads nothing from the network.