Jq
lastmod 2026-06-10created 2020-12-0415 edits
jq is a lightweight and flexible command-line JSON processor.
About
jq is like sed for JSON data.
- That is, just as tools like sed, awk, and grep handle text, jq lets you easily slice, filter, map, and transform structured data.
- jq is written in portable C and has no runtime dependencies. You can download a single binary, scp it to a remote machine of the same type, and it works right away.
- jq can convert your current data format into the format you want with minimal effort, and the programs to do so are often short and concise.
Example
-
.info.datas[0].meta
How to add an Object
Using a key's value as a key
Result:
How to remove quoting from strings
The result is "1234", printed with quotes. To remove the quotes, add the -r (Raw Output) option:
The result is printed as 1234.
How to merge results into strings
[
{"key": "name", "value": "John"},
{"key": "age", "value": 30},
{"key": "city", "value": "New York"}
]
Result:
See also
- Json
- htmlq - Like jq, but for HTML.
- Fq - jq for binary formats
- pyjq - A Python binding for ./jq
- jqpy - Python bindings for jq
- jq.py - JQpy is Python binding for JQ (JSON processing language) that simply works on any platform (even Windows) and does not require compilation.
- jmespath
- jsonpath-ng
- jsonschema
- mdq - jq for Markdown
- JSON Query - A small, flexible, and extensible JSON query language
- jsongrep - Faster than jq
- mq - jq-style Markdown query language
Favorite site
- jq web site
- Github - jqlang/jq
- Working with JSON in bash using jq
- Command-line JSON processor jq: basic syntax and how it works | 44BITS
- Transforming JSON with jq: an interactive guide | GeekNews
Online Tools
- jqplay - Playground jq
- jq Playground | Navendu Pottekkat - The Open Source Absolutis
Pages that link here