jq Command-Line JSON Processor
stedolan.github.io
2
Leaving SiteNav
External Link Disclaimer
You are about to visit stedolan.github.io. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
jq is a lightweight and flexible command-line JSON processor, analogous to sed, awk, and grep for JSON data. Created by Stephen Dolan in 2012, jq has become the standard tool for parsing, filtering, transforming, and generating JSON data in Unix pipelines and shell scripts. Key features: Turing-complete functional programming language for JSON manipulation, supporting variables, functions, conditionals, recursion, and higher-order functions. Filtering and selection: path-based expressions for navigating nested JSON structures using dot notation (.foo.bar), array indexing (.[0], .[-1]), array slicing (.[2:5]), and object iteration (.[]). Object and array construction: build new JSON objects and arrays from selected or computed values using {key: .value} and [expression] syntax. Built-in functions: length, keys, values, has, contains, split, join, map, select, recurse, walk, to_entries, from_entries, group_by, unique, sort, reverse, min, max, add, floor, ceil, round, tonumber, tostring, ascii, index, rindex, ltrimstr, and hundreds more. String operations: split, join, ltrimstr, rtrimstr, sub, gsub, test, match, capture, scan, splits with regex support via the Oniguruma library. Mathematical operations: addition, subtraction, multiplication, division, modulo, and standard math functions. JSON to CSV/TSV conversion. Conditional expressions: if-then-else-end, and/or/not, alternative operator (//). Error handling: try-catch for graceful error recovery. Streaming mode: --slurp and --stream for processing large JSON files line by line. Format options: --compact-output, --tab, --indent, --raw-input, --raw-output, --join-output. Module system for importing reusable filters. jq modules and library functions. Bindings and ports: gojq (Go), jaq (Rust), jqnpm (Node.js). Cross-platform: Linux, macOS, Windows, and BSD. Open source under MIT.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike