I have a package dictionary with the package name being the key, and some details dictionary is the value:
{
"php7.1-readline": {
"latest": "7.1.9-1+ubuntu14.04.1+deb.sury.org+1",
"origins": [
"ppa.launchpad.net"
],
"version": "7.1.6-2~ubuntu14.04.1+deb.sury.org+1",
"www": "http://www.php.net/"
},
"php7.1-xml": {
"latest": "7.1.9-1+ubuntu14.04.1+deb.sury.org+1",
"origins": [
"ppa.launchpad.net"
],
"version": "7.1.6-2~ubuntu14.04.1+deb.sury.org+1",
"www": "http://www.php.net/"
},
"plymouth": {
"version": "0.8.8-0ubuntu17.1"
},
....
}
I would like to reduce the above to a dictionary only with packages that have an attribute latest
in their meanings.
It would seem that json_query
this is a filter, but I can not understand the syntax. The examples there all seem to work on dictionary lists, not dictionaries of the same ...
For example, if I โplugโ the specified dictionary into json_query('*.latest')
, I get a list of the latest latest versions:
[
"7.1.9-1+ubuntu14.04.1+deb.sury.org+1",
"7.1.9-1+ubuntu14.04.1+deb.sury.org+1",
"7.1.6-2~ubuntu14.04.1+deb.sury.org+1"
]
How can I get all the dictionary elements instead?
Any hope?
source
share