1/17
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What command is used to make readable JSON content?
jq '.' sample_nows.json
How do you extract the first object from a JSON array?
jq 'first(.[])' sample_nows.json
What command retrieves the last JSON element?
jq 'last(.[])' sample_nows.json
How do you extract the first three elements of a JSON array?
jq 'limit(3;.[])' sample_nows.json
How can you extract elements from index 2 to 3 in JSON (Python-style slicing)?
jq '.[2:4]' sample_nows.json
How can you extract the balance and age fields from each JSON object?
jq '.[] | [.balance,.age]' sample_nows.json
How do you calculate the years left until age 65 for each person?
jq '.[] | [.age, 65 - .age]' sample_nows.json
What command converts JSON data into CSV format?
jq '.[] | [.company, .phone, .address] | @csv' sample_nows.json
How do you output JSON data in a tab-separated format?
jq '.[] | [.company, .phone, .address] | @tsv' sample_nows.json
How do you output JSON data with a custom pipe (|) delimiter?
jq '.[] | [.company, .phone, .address] | join("|")' sample_nows.json
How do you convert the age field to a string before joining values?
jq '.[] | [.balance,(.age | tostring)] | join("|")' sample_nows.json
How do you extract all friend names from a JSON array?
jq '.[] | [.friends[].name]' sample_nows.json
How do you extract the first and last names from JSON objects?
jq '.[] | [.name.first, .name.last]' sample_nows.json
How do you filter JSON elements where index is greater than 2?
jq 'map(select(.index > 2))' sample_nows.json
How do you sort JSON data by age in ascending order?
jq 'sortby(.age)' samplenows.json
How do you sort JSON data by age in descending order?
jq 'sortby(-.age)' samplenows.json
How can you fetch and parse GitHub status using jq?
curl -s https://www.githubstatus.com/api/v2/status.json | jq '.'
How do you extract only the status field from the GitHub status API?
curl -s https://www.githubstatus.com/api/v2/status.json | jq '.status'