Windows
Linux
PowerShell Equivalents
Text Processing
Windows PowerShell ConvertFrom-Json equivalent in Linux
Parses JSON and selects fields, array elements or transformed output.
Windows
→
PowerShell ConvertFrom-Json
Linux equivalents
jq EXPRESSION file.json
jq EXPRESSION file.json
jq EXPRESSION file.json
Overview
What this command does
Parses JSON and selects fields, array elements or transformed output.
Migration tip:
jq is a dedicated JSON processor. Use -r when you want raw strings without JSON quotation marks.Practical tasks
Common use cases
Read and query JSON
Parses JSON and selects fields, array elements or transformed output.
jq . data.json
Pretty-print JSON
jq -r ".name" data.json
Extract one string field
jq ".items[] | select(.enabled == true)" data.json
Filter array objects
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
jq . data.json
jq -r ".name" data.json
jq ".items[] | select(.enabled == true)" data.json
Walkthrough
Examples with explanations
jq . data.json # format and validate JSON
jq -r ".name" data.json # extract one field
jq ".items[] | select(.enabled == true)" data.json # filter JSON objects
Reference
Common options and variations
| Command or option | Use |
|---|---|
jq . data.json | Pretty-print JSON |
jq -r ".name" data.json | Extract one string field |
jq ".items[] | select(.enabled == true)" data.json | Filter array objects |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | jq EXPRESSION file.json |
Same command on this distribution. |
| Fedora | same command | jq EXPRESSION file.json |
Same command on this distribution. |
| Arch | same command | jq EXPRESSION file.json |
Same command on this distribution. |
Keep learning