Untitled Flashcards Set

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/17

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

18 Terms

1
New cards

What command is used to make readable JSON content?

jq '.' sample_nows.json

2
New cards

How do you extract the first object from a JSON array?

jq 'first(.[])' sample_nows.json

3
New cards

What command retrieves the last JSON element?

jq 'last(.[])' sample_nows.json

4
New cards

How do you extract the first three elements of a JSON array?

jq 'limit(3;.[])' sample_nows.json

5
New cards

How can you extract elements from index 2 to 3 in JSON (Python-style slicing)?

jq '.[2:4]' sample_nows.json

6
New cards

How can you extract the balance and age fields from each JSON object?

jq '.[] | [.balance,.age]' sample_nows.json

7
New cards

How do you calculate the years left until age 65 for each person?

jq '.[] | [.age, 65 - .age]' sample_nows.json

8
New cards

What command converts JSON data into CSV format?

jq '.[] | [.company, .phone, .address] | @csv' sample_nows.json

9
New cards

How do you output JSON data in a tab-separated format?

jq '.[] | [.company, .phone, .address] | @tsv' sample_nows.json

10
New cards

How do you output JSON data with a custom pipe (|) delimiter?

jq '.[] | [.company, .phone, .address] | join("|")' sample_nows.json

11
New cards

How do you convert the age field to a string before joining values?

jq '.[] | [.balance,(.age | tostring)] | join("|")' sample_nows.json

12
New cards

How do you extract all friend names from a JSON array?

jq '.[] | [.friends[].name]' sample_nows.json

13
New cards

How do you extract the first and last names from JSON objects?

jq '.[] | [.name.first, .name.last]' sample_nows.json

14
New cards

How do you filter JSON elements where index is greater than 2?

jq 'map(select(.index > 2))' sample_nows.json

15
New cards

How do you sort JSON data by age in ascending order?

jq 'sortby(.age)' samplenows.json

16
New cards

How do you sort JSON data by age in descending order?

jq 'sortby(-.age)' samplenows.json

17
New cards

How can you fetch and parse GitHub status using jq?

curl -s https://www.githubstatus.com/api/v2/status.json | jq '.'

18
New cards

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'