jq is a succinct programming language for querying and manipulating JSON data
Elevate your jq skills through 77 curated exercises across 11 core concepts. Master problem-solving with a structured learning path designed for modern developers.
jq is a tool for parsing and transforming JSON data.
jq is like sed for JSON data -- you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.
jq is a dynamically-typed functional programming language.
All values are immutable.
jq programs are composed of pipelines of "filters": each filter takes a single item as input, acts on it, and outputs zero or more transformed elements.
A "filter" can also be called an "expression".
The output(s) of an expression can be passed to another using the | operator.
expressionA | expressionB applies expressionA to some input, then expressionB executes repeatedly for each of the outputs of expressionA.
The input to an expression can be referred to explicitly as ..
An expression that adds 1 to its input reads like so: . + 1 (or 1 + .).
jq (the program) versus jq (the language)jq is a program you can install as a package on a variety of operating systems,
or build it from source (it's coded in C).
It has several useful command-line options, and is quite fast.
The jq program also implements a language to enable arbitrarily complex manipulations of the input data.
This Exercism track will focus on the language.
You will see usage of the jq program in the tests.
This Exercism track will focus on the original implementation of jq, whose home is https://jqlang.github.io/jq/.
Other implementations, such as gojq, may have different syntax to what is documented here.
From json.org:
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
This track is about jq not JSON.
We will assume you are familiar with JSON syntax and data types.
Widely used
jq has become a de-facto leader for transforming JSON data.
Small and fast
jq is available as a single binary with no dependencies, it's simple to install.
Generating JSON
Generate valid JSON using command-line options to avoid worrying about quoting edge cases.
Reporting
Reporting from REST APIs: piping the output of curl into jq is a powerful addition to your toolbox.
CI tooling
You may already be using jq in your CI workflows: get more comfortable with jq to amplify its power.
A functional language
jq is a functional programming language: jq code is very concise and maintainable.
Widely used
jq has become a de-facto leader for transforming JSON data.
Small and fast
jq is available as a single binary with no dependencies, it's simple to install.
Generating JSON
Generate valid JSON using command-line options to avoid worrying about quoting edge cases.
Reporting
Reporting from REST APIs: piping the output of curl into jq is a powerful addition to your toolbox.
CI tooling
You may already be using jq in your CI workflows: get more comfortable with jq to amplify its power.
A functional language
jq is a functional programming language: jq code is very concise and maintainable.