jq <filter> [files...]

Command-line JSON processor


filterMust be enclosed in single quotes


--versionOutput the jq version and exit with zero
--seqUse the application/json-seq MIME type scheme for separating JSON texts in jq's input and output
--streamParse the input in streaming fashion, outputting arrays of path and leaf values
--slurp, -sInstead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once
--raw-input, -RDon't parse the input as JSON. Instead, each line of text is passed to the filter as a string
--null-input, -nDon't read any input at all! Instead, the filter is run once using null as the input
--compact-output, -cBy default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line
--tabUse a tab for each indentation level instead of two spaces
--indent <n>Use the given number of spaces for indentation
--color-output, -CBy default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using -C
--monochrome-output, -MDisable color
--ascii-output, -aJq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences
--unbufferedFlush the output after each JSON object is printed
--sort-keys, -SOutput the fields of each object with the keys in sorted orde
--raw-output, -rIf the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes
--join-output, -jLike -r but jq won't print a newline after each output
-f, --from-file <filename>Read filter from the file rather than from a command line
-L <directory>Prepend directory to the search list for modules
-e, --exit-statusSets the exit status of jq to 0 if the last output values was neither false nor null, 1 if the last output value was either false or null, or 4 if no valid result was ever produced
--arg <name> <value>This option passes a value to the jq program as a predefined variable
--argjson <name> <JSON-text>This option passes a JSON-encoded value to the jq program as a predefined variable
--slurpfile <variable name> <filename>This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable
--rawfile <variable name> <filename>This option reads in the named file and binds its contents to the given global variable
--argsRemaining arguments are positional string arguments. These are available to the jq program as $ARGS.positional[]
--jsonargsRemaining arguments are positional JSON text arguments. These are available to the jq program as $ARGS.positional[]
--run-tests [filename]Runs the tests in the given file or standard input. This must be the last option given and does not honor all preceding options