jq '.' file.json | 예쁘게 출력 |
jq -c '.' file.json | 압축 출력 |
jq -r '.name' file.json | 원시 문자열 출력 |
jq -s '.' *.json | 배열로 수집 |
curl url | jq '.' | curl에서 파이프 |
.key # Get field
.key.nested # Nested field
.["key-name"] # Key with special chars
.key? # Optional (no error if null) .[0] # First element
.[-1] # Last element
.[2:5] # Slice (index 2-4)
.[] # All elements (iterate) length # Array/string length
keys # Object keys as array
reverse # Reverse array
sort # Sort array
unique # Remove duplicates
flatten # Flatten nested arrays select(condition) # Filter by condition
map(f) # Apply f to each element
# Examples
[1,2,3,4] | map(. * 2) # [2,4,6,8]
.[] | select(.age > 18) # Filter objects {name: .name, age: .age} # Create new object
{(.key): .value} # Dynamic key
. + {new: "field"} # Add field [.items[].name] # Collect into array
group_by(.category) # Group by field
sort_by(.date) # Sort by field ascii_downcase # Lowercase
ascii_upcase # Uppercase
split(",") # Split to array
join(",") # Join array
test("regex") # Regex test
gsub("a";"b") # Replace all