Re: list elements of set

Slavko <[email protected]> Sat, 27 Sep 2025 19:54:14 +0000
Newsgroups gmane.comp.security.firewalls.netfilter.general
Message-ID <[email protected]>
Dňa 27. septembra 2025 19:19:42 UTC používateľ Kerin Millar <[email protected]> napísal:
>On Sat, 27 Sep 2025, at 6:24 PM, Slavko wrote:
>> Dňa 27. septembra 2025 10:59:54 UTC používateľ Kerin Millar 

>> 1. the nftables is list of objects, thus one must first filter the "metadata"
>>    object, it is first list item, but who know if it is guaranted
>
>I don't think this particular criticism carries much weight.

I understand how are metadata useful, and i do not ask to omit it, but
my idea is/was that "nftables" can be object (instead of list):

    {"nftables": {
        "metadata": {...},
        "sets": [
            {...},
            ...
        ]
    }}

Thus one can just use:

    jq ".nftables.sets[]"

Instead of ugly:

    jq ''.nftables[1:][].set'

Or too long:

    jq '.nftables[] | select(.set != null).set'

regards


-- 
Slavko
https://www.slavino.sk/