I have a JSON file from which I am trying to get a value using below
[a223180n@363748ln41dk012 ~]$ cat status.json| jq '.details.server1.status'
"UP"
In my script, I have the option where the user will enter the server name. So I need the script to pick that value and update the jq command accordingly I am using below and it is failing.
jq is 1.6 version
[a223180n@363748ln41dk012 ~]$ cat status.json| jq --arg server server1'.details.$server.status'
jq: error: syntax error, unexpected '$', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.details.$service.status
jq: 1 compile error