davhojt
92b6e9ac8c
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
json-researcher
Instructions
Create the script json-researcher.sh
which will show the "name" and the "power" of the superhero with id: 1
-
Where to look : https://((DOMAIN))/assets/superhero/all.json
-
What to use :
curl
andjq
andgrep
-
The output should be exactly like the example below but with the expected name
$./json-researcher.sh | cat -e
"name": "<...>",$
"power": <...>,$
$
Watch the videos:
Hints
With curl
you can get the content of the file from the url:
$ curl https://((DOMAIN))/assets/superhero/all.json
<...>
$
jq
is a command-line utility that can slice, filter, and transform the components of a JSON file
$cat fruit.json
{
"name": "apple",
"color": "green",
"price": 1.0
}
$jq '.color' fruit.json
"green"
$
grep
is a command-line utility for searching plain-text data sets for lines that match a regular expression.
$cat fruit.json
{
"name": "apple",
"color": "green",
"price": 1.0
}
$cat fruit.json | grep color
"color": "green",
$
You may need to use pipes (|)
and the logical operator &&
.
You have to use Man or Google to know more about commands flags, in order to solve this exercise! Google and Man will be your friends!