Transform JSON Reliably with jq

8 steps · about 3 h 5 min · Beginner

  1. Run the first jq filters (guide, jq, 25 min)

    Format JSON, select fields and send a document through a simple command-line pipeline.

  2. Navigate values and arrays (reference, jq, 25 min)

    Use identity, object lookup, array indexing and iteration without converting data to text prematurely.

  3. Preserve JSON types (reference, jq, 20 min)

    Distinguish null, booleans, numbers, strings, arrays and objects during transformations.

  4. Iterate nested structures (reference, jq, 20 min)

    Expand arrays and objects into a stream that later filters can select and combine.

  5. Map values into a new shape (reference, jq, 25 min)

    Apply a filter across collections and construct the output structure explicitly.

  6. Filter records by conditions (reference, jq, 20 min)

    Select only records that satisfy typed comparisons and compound boolean rules.

  7. Aggregate a stream (reference, jq, 25 min)

    Reduce records into counts, totals or indexed objects without an external script.

  8. Produce safe shell output (reference, jq, 25 min)

    Choose raw, compact, sorted and null-input modes deliberately and check the exit status.