netconnectcli strips out curly braces and commas from JSON result
I'm not sure if this is by design but it appears netconnectcli returns JSON results that are missing the curly braces and commas. I think from the readme it's supposed to return JSON data though?
For example running netconnectcli status returns:
SuccessResponse:
connections:
ap:
True
wifi:
False
wired:
True
devs:
[
eth0
]
wifi:
valid_config:
False
current_address:
None
present:
True
current_ssid:
None
link:
True
It looks like JSON but it's missing curly braces and commas. The netconnectcli list_wifi command in particular is really hard to parse & understand without braces as everything gets put into a list and the top level names collide:
pi@raspberrypi:~ $ netconnectcli list_wifi
SuccessResponse:
[
encrypted:
False
signal:
-82
ssid:
xfinitywifi
channel:
6
address:
74:85:2A:E7:17:DA
encrypted:
True
signal:
-83
ssid:
HOME-8BC0-2.4
channel:
6
address:
74:85:2A:E7:17:D8
encrypted:
True
signal:
-86
ssid:
Kayes98011a
channel:
6
address:
00:1E:2A:10:83:A6
encrypted:
True
signal:
-48
ssid:
tony-2.4
channel:
11
address:
C0:4A:00:EE:E6:B1
encrypted:
True
signal:
-92
ssid:
channel:
11
address:
60:02:92:B1:15:A9
encrypted:
False
signal:
-96
ssid:
LuckyPanda-guest
channel:
11
address:
68:7F:74:D7:1C:E1
]
Wanted to check is it perhaps a bug that curly braces and commas are stripped out, or is it by design? If it is by design any suggestion on how to parse the output easily--the list_wifi output in particular is pretty gnarly to parse right now.
That's because it's not actually serializing the result to JSON here but instead using some custom pretty printer function.
Come to think of it however I have no idea why I didn't simply serialize it to JSON, which would make a lot of sense actually for this output.
I don't know when I'll get around to this, but in principle this here should simply dump formatted json instead of the custom stuff there.