Best JSON CLI Tools

Compare jq, yq, gojq, fx, dasel, gron and qo for querying, filtering and transforming JSON (and YAML) from the command line.

Updated

short verdict

Start with jq: its query language is the reference that gojq and yq imitate, and it is a C binary with no runtime dependencies. Pick yq when the files are YAML, gojq for big integers or a pure Go build, fx or gron for exploring unknown payloads, and qo if you would rather write SQL.

Command-line JSON tools split into a few groups. jq and gojq use the jq query language. yq and dasel extend querying to YAML, TOML, XML and CSV. fx, gron and qo change how you explore data: a JavaScript-based viewer, a grep-friendly flattening, and a SQL interface. The right pick depends on whether you are scripting, converting formats or exploring an unfamiliar response.

this page is for

  • Developers piping API responses through shell scripts
  • DevOps engineers editing YAML and JSON config in CI
  • Anyone exploring large JSON payloads with unknown structure
  • Analysts who prefer SQL over a path language
#1

jq

★ 36.0kC
details

jq is the default JSON filter: a query language for slicing, mapping and transforming data, shipped as a C binary with zero runtime dependencies.

best for

  • Shell scripts and pipelines that process API responses
  • Log analysis and data pipeline steps
  • Static or cross-compiled builds

strengths

  • Query language covers array manipulation, object construction, conditionals and math
  • Portable C with no runtime dependencies; can be built as a statically linked binary
  • Runs from Docker via ghcr.io/jqlang/jq:latest or builds from source

weaknesses

  • JSON only; YAML, XML and CSV are not covered
  • The query language has a learning curve for nested transforms
  • No interactive viewer for browsing a document
#2

yq

★ 16.2kGo
details

yq applies jq-like syntax to YAML, JSON, XML, CSV and INI, and edits files in place with -i.

best for

  • Editing Kubernetes-style and CI YAML files
  • Converting between YAML, JSON, XML and CSV
  • GitHub Actions and container-based pipelines

strengths

  • Preserves formatting and comments on updates and handles multi-document YAML
  • Format conversion with output flags such as -o json
  • Merges files with load() and substitutes environment variables

weaknesses

  • Syntax is jq-like, not identical, so existing jq filters may need changes
  • Narrower as a pure JSON transformer than as a config editor
#3

gojq

★ 3.8kGo
details

gojq is a pure Go implementation of jq that keeps large integers exact and reads YAML with --yaml-input.

best for

  • Data with integers too large for floating point
  • Environments where a C build is inconvenient
  • Go programs that need embedded jq queries

strengths

  • Arbitrary-precision integer arithmetic avoids precision loss
  • --yaml-input and --yaml-output flags handle YAML
  • Usable as a Go library via gojq.Parse()

weaknesses

  • Compatible with most, not all, jq functionality
  • Smaller user base than jq, so fewer shared snippets
#4

fx

★ 20.7kGo
details

fx pairs an interactive terminal viewer with JavaScript expressions for filtering and transforming JSON.

best for

  • Browsing large JSON documents interactively
  • Developers who already know JavaScript
  • Quick inspection of API output

strengths

  • Interactive mode for exploring complex structures
  • Queries are written as JavaScript expressions and built-in functions
  • Syntax highlighting and formatting, plus a streaming mode for piped input

weaknesses

  • JavaScript expressions differ from the jq syntax common in scripts
  • Focused on JSON; no multi-format conversion is documented
#5

dasel

★ 8.1kGo
details

dasel uses one selector syntax across JSON, YAML, TOML, XML, CSV, HCL and INI, including writes such as foo.bar = "new_value".

best for

  • Repos mixing TOML, YAML and JSON configs
  • Scripts that update values in place
  • Embedding queries in Go applications

strengths

  • Same query syntax for every supported format
  • Supports updates, insertions and deletions, plus ..key recursive search
  • Also available as a Go library

weaknesses

  • Its own syntax, so jq filters do not carry over
  • Smaller community than jq or yq
#6

gron

★ 14.5kGo
details

gron flattens JSON into greppable assignment lines and rebuilds JSON with --ungron.

best for

  • Finding where a value lives in an undocumented response
  • Diffing two JSON files
  • Fetching from a URL and grepping in one step

strengths

  • Shows the full path to every value, so grep and diff work directly
  • --ungron turns filtered assignments back into valid JSON
  • Accepts files, URLs or stdin, with streaming mode for line-delimited JSON

weaknesses

  • Not a query language; no arithmetic or object construction
  • Output is verbose for large documents
#7

qo

★ 400Go
details

qo runs SQL against JSON, JSONL, CSV, TSV and PSV files through a TUI or the -q flag, using SQLite underneath.

best for

  • Joining and aggregating across several files
  • Filtering logs with SQL
  • Analysts who know SQL better than jq

strengths

  • Full SQLite syntax, including JSON extraction functions
  • Interactive TUI with vim-style navigation, or non-interactive -q
  • Converts between JSON, CSV and other formats

weaknesses

  • Flat, SQL-shaped thinking fits deeply nested JSON less naturally
  • Newer and less widely adopted than jq
  • No YAML support is documented

How to choose

  • Scripting JSON in pipelines: jq, with the broadest shared filter knowledge and no runtime dependencies.
  • YAML or multi-format editing: yq keeps comments and formatting and converts with -o json.
  • Exact large integers or a pure Go binary: gojq, which has arbitrary-precision arithmetic.
  • Exploring an unknown payload: gron for grep and diff, fx for an interactive viewer.
  • Mixed TOML, HCL and JSON configs, or SQL queries: dasel for one syntax, qo for SQLite-backed SQL.

When not to use these

  • Your data is huge tabular data better served by a database; these tools work on documents piped through a terminal.
  • You need a schema validator; none of these are documented as validating against a schema.

FAQ

Which tool should I learn first for JSON on the command line?
jq. Its query language is the one gojq reimplements and yq imitates, so the skills carry over.
Can I process YAML with a jq-style syntax?
Yes. yq uses jq-like syntax for YAML, JSON, XML, CSV and INI, and gojq reads and writes YAML with --yaml-input and --yaml-output.
What is the difference between jq and gojq?
gojq is a pure Go implementation with no C dependencies. It adds arbitrary-precision integers and YAML flags, and supports most but not all of jq.
How do I find a field in a huge JSON response?
Pipe it through gron and grep the output, which prints the full path to each value. You can also browse it interactively in fx.