Skip to content
FindUtils
Trending ToolsGuidesBlogRequest a Tool
Sponsor
New

328 tools now run in your code and in your AI client. REST API and MCP server, no API key, no signup.

REST API MCP server
  1. Home
  2. Cheatsheets
  3. Programming
  4. jq Commands
Programming

jq Commands

Pretty-print, select, map, and transform JSON on the command line

37 entries7 sectionsCopy an entry or print the full reference.
A mint filter sorts irregular JSON fragments into ordered data blocks.

37 entries · Use the copy icon.

All cheatsheets
On this pageEntries
Basics7Arrays and objects6select and map5Transform6Sort and aggregate6Strings and CLI6Sources1

1Basics

7 entries
Basics: syntax and descriptions
SyntaxDescription
jq . file.json
Pretty-print JSON
jq -c . file.json
Compact one-line JSON
jq -r .name file.json
Raw string without quotes
jq .user.email file.json
Read a nested field
jq .name // "unknown"
Default when null or missing
jq .items[0]
First array element
jq .items[-1]
Last array element

2Arrays and objects

6 entries
Arrays and objects: syntax and descriptions
SyntaxDescription
jq .items[]
Stream each array item
jq .items[1:4]
Slice array indexes 1, 2, 3
jq keys
List object keys
jq has("email")
True if the key exists
jq length
Length of array, object, or string
jq type
JSON type of the input

3select and map

5 entries
select and map: syntax and descriptions
SyntaxDescription
jq ".[] | select(.active)"
Keep matching objects
jq "map(.email)"
Project one field into an array
jq "map(select(.score > 50))"
Filter then keep an array
jq ".[] | select(has("email"))"
Keep objects with a key
jq "select(.role == "admin")"
Match a string field

4Transform

6 entries
Transform: syntax and descriptions
SyntaxDescription
jq "{name, id}"
Build a smaller object
jq "del(.password)"
Remove a field
jq ".count += 1"
Update a number field
jq "to_entries"
Object to key/value array
jq "from_entries"
Key/value array to object
jq "flatten"
Flatten nested arrays

5Sort and aggregate

6 entries
Sort and aggregate: syntax and descriptions
SyntaxDescription
jq "sort_by(.name)"
Sort objects by a field
jq "unique_by(.email)"
Deduplicate by a field
jq "group_by(.team)"
Bucket objects by a field
jq "map(.price) | add"
Sum a numeric field
jq "min_by(.age)"
Object with the lowest field
jq "max_by(.score)"
Object with the highest field

6Strings and CLI

6 entries
Strings and CLI: syntax and descriptions
SyntaxDescription
jq -r ".name | ascii_downcase"
Lowercase a string
jq -r "split("/")"
Split a string into an array
jq -r "join(",")"
Join an array into a string
jq "select(.msg | test("error"; "i"))"
Regex match, ignore case
curl URL | jq .
Pretty-print an HTTP JSON body
jq -n --arg n "$NAME" '{name:$n}'
Build JSON from a shell variable

7Sources

1 entries
Sources: syntax and descriptions
SyntaxDescription
https://jqlang.org/manual/
jq manual: command-line filters and options. Browser playgrounds can support a smaller subset.

Related Cheatsheets

ProgrammingNew

Barcode Formats

Barcode labels, an optical scanner, and a magnifying lens showing bar spacing.

Code 128, Code 39, EAN and UPC inputs, check digits, export settings, and print checks for barcode generation.

40 entriesOpen reference
Programming

JavaScript ES6+

Dark curly braces enclose yellow blocks that form an arrow.

Modern JavaScript syntax: destructuring, arrow functions, promises, modules, and built-in methods

59 entriesOpen reference
Programming

Python Essentials

Blue and gold ribbon snakes above ordered data cards.

Python syntax, data structures, comprehensions, built-in functions, and common patterns

59 entriesOpen reference
FindUtils

Tools for the task. Guides for the next step.

Manage data

Tools

  • All tools
  • New tools
  • Password Generator
  • QR Code Generator
  • JSON Formatter
  • PDF Merger
  • Image Compressor
  • Base64 Encoder

Explore

  • Guides
  • Cheatsheets
  • Blog
  • Color Converter
  • Gradient Generator
  • Box Shadow Generator
  • UUID Generator

Developers

  • Tool API
  • API Docs
  • MCP Server
  • Libraries
  • OpenAPI Spec
  • llms.txt

FindUtils

  • About
  • Contact
  • Request a tool
  • Article writing service
  • Sponsor FindUtils
  • Domains for sale
  • Public traffic (24 hours)
  • Public traffic (30 days)

© 2026 FindUtils. All rights reserved.

Privacy policyTerms of serviceSitemap