I found solution/workaround:
there is a parameter -j, which outputs to json format, so if you run nft with
this parameter, you will get JSON formatted output.
nft -j list ruleset
{"nftables": [{"table": {"family": "inet", "name": "filter", "handle": 14}},
{"chain": {"family": "inet", "table": "filter", "name": "input", "handle": 1,
"type": "filter", "hook": "input", "prio": 0, "policy": "accept"}}, {"chain":
{"family": "inet", "table": "filter", "name": "forward", "handle": 2, "type":
"filter", "hook": "forward", "prio": 0, "policy": "accept"}}, {"chain":
{"family": "inet", "table": "filter", "name": "output", "handle": 3, "type":
"filter", "hook": "output", "prio": 0, "policy": "accept"}}]}
It’s bit confusing, the man page refers to "nft export json“ and there is no
mention about -j parameter…
S pozdravem
Michal Šafránek
Tel.: 775 610 810
E-mail: [email protected]