In the below Json file, I am trying to extract "Name": "abcd","Version": "1.0.2" and "Severity": "Medium".
"status": "scanned","data": {"Layer": {"IndexedByVersion": 3,"NamespaceName": "debian:9","ParentName": "e762","Name": ".4530bfac-5e99-4138-b071-4286c06669a3","Features": [ {"Name": "openssl1.0","VersionFormat": "dpkg","NamespaceName": "debian:9","AddedBy": "85aa73fb8281cc252ed7e151f10386f36588ec6c967d45136103a4e1e705a81c.01bc7eff-9a5d-43f5-ab14-2e3e470cba77","Version": "1.0.2q-1~deb9u1","Vulnerabilities": [ {"Severity": "Medium","NamespaceName": "debian:9","Link": "xxxx","FixedBy": "1.0.2r-1~deb9u1","Description": " n must call SSL_shutdown() twice even if a protocol error has occurred (applications should not do this but some do anyway). Fixed in OpenSSL 1.0.2r (Affected 1.0.2-1.0.2q).","Name": "CVE-2019-1559","Metadata": {"NVD": {"CVSSv2": {"Score": 4.3,"Vectors": "AV:N/AC:M/Au:N/C:P/I:N" } } } } ] }, {"VersionFormat": "dpkg","NamespaceName": "debian:9","Version": "0.16-1+deb9u1","Name": "libidn2-0","AddedBy": "85aa73fb8281cc252ed7e151f10386f36588ec6c967d45136103a4e1e705a81c.01bc7eff-9a5d-43f5-ab14-2e3e470cba77" }, {"VersionFormat": "dpkg","NamespaceName": "debian:9","Version": "0.29-4","Name": "pkg-config","AddedBy": "4d2169f1dc7652ffd2a4f32d2c0ae2 }, {"Name": "nettle","VersionFormat": "dpkg","NamespaceName": "debian:9","AddedBy": "7494d6c991278b43e8388f7cec2f138075"Version": "3.3-1","Vulnerabilities": [ {"Severity": "Low","NamespaceName": "debian:9","Link": "xxxx","Description": "er.","Name": "CVE-2018-16869","Metadata": {"NVD": {"CVSSv2": {"Score": 3.3,"Vectors": ":P" }
So far I am able to extract the values of Name & version using the jq command below.
jq -r '.data.Layer| .Features[] | "\(.Name) \(.Version)"' status.json
but when I try to extract values of "Severity" field using the below command
`jq -r '.data.Layer| .Features[] | "\(.Name) \(.Version)"| .Vulnerabilities[].Severity' status.json`
I get the error message in the title.
Required output: abcd 12.0 medium
Any help is much appreciated.