<
Process JSON with JQ
Query
JQ Expression
Select a common expression...
.people[0].name - Get first person's name
.people[].name - Get all names
.people[] | select(.age > 30) - Filter by age > 30
.people[] | select(.age < 30) | .name - Names under 30
.people | length - Count items in array
.people | sort_by(.age) - Sort by age
.people[0:2] - Get first 2 items
.company.name - Get nested property
. - Return entire object
keys - Get all keys
.people | map(.name) - Map to names only
.people | group_by(.city) - Group by city
Input JSON
{ "people": [ {"name": "John", "age": 30, "city": "New York"}, {"name": "Jane", "age": 25, "city": "San Francisco"}, {"name": "Bob", "age": 35, "city": "Chicago"} ], "company": { "name": "Tech Corp", "founded": 2010 } }
Output
This feature is using
jq-web
(
license
).