28
loading...
This website collects cookies to deliver better user experience
jq '.name' package.json
# this downloads the latest APOD and saves to a file
url="https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY"
curl -o apod.png "$(curl -s $url | jq -r '.hdurl')"
echo '{"id": 1, "name": "Cam"}' | jq '.id'``
# 1
echo '{"nested": {"a": {"b": 42}}}' | jq '.nested.a.b'
# 42
echo '[0, 1, 1, 2, 3, 5, 8]' | jq '.[3]'
# 3
echo '[{"id": 1, "name": "Mario"}, {"id": 2, "name": "Luigi"}]' | jq '.[1].name'
# Luigi
echo '["a", "b", "c", "d"]' | jq '.[1:3]'
# ["b", "c"]
echo '["a", "b", "c", "d"]' | jq '.[1:]'
# ["b", "c", "d"]
echo '{ "a": 1, "b": 2 }' | jq '{ a: .b, b: .a }'
# { "a": 2, "b": 1 }
28