The current implementation adds configured vlans as "vlan": [ ... ] into an array. This is malformed json and fails to be parsed. This patch creates an object to include this key value pair.
Test with: ip l a type bridge ./bridge/bridge -j vlan | jq fixes c7c1a1ef5 Signed-off-by: Tobias Jungel <tobias.jun...@bisdn.de> --- bridge/vlan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bridge/vlan.c b/bridge/vlan.c index 19a36b80..9376b985 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -632,6 +632,7 @@ void print_vlan_info(FILE *fp, struct rtattr *tb) if (!is_json_context()) fprintf(fp, "%s", _SL_); + open_json_object(NULL); open_json_array(PRINT_JSON, "vlan"); for (i = RTA_DATA(list); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { @@ -659,6 +660,7 @@ void print_vlan_info(FILE *fp, struct rtattr *tb) } close_json_array(PRINT_ANY, "\n"); + close_json_object(); } int do_vlan(int argc, char **argv)