I need something very simple. Sorry I am not familiar with jq and a top novice.
{"pets": [ {"name": "Purrsloud","species": "Cat","favFoods": ["wet food","dry food","<strong>any</strong> food" ],"birthYear": "feat-2016" }, {"name": "Barksalot","species": "Dog","birthYear": "feat-2008" }, {"name": "Meowsalot","species": "Cat","favFoods": ["tuna","catnip","celery" ],"birthYear": "feat-2012" } ]}I would like to test 2 jq commands so 2 outputs to:
- 1st test: Fetch only the value
Meowsalot
.pets[].name.MeowsalotI am not sure what I am doing wrong above. The output error on jqplay.org:
Error: jq: error (at /dev/stdin:28): Cannot index string with string "Meowsalot"
- 2nd test: Fetch only the highest
birthYearvalue which should befeat-2016. By doing some research I saw that themax_byfunction could do it but really unsure how to use it.
Thanks team