Pretty indent --info JSON output (see below for details)

Changes to make --info much more human readable (while still keeping
machine readabilty for anyone foolish enough to be parsing the existing
output as text)

* change message_to_json to optionally not strip the multiline JSON
* use multiline=True for the two places we are printing to the console
* make the node list JSON indented
This commit is contained in:
geeksville
2024-04-26 15:15:57 -07:00
parent 2f9307fd99
commit 7fe98bc266
3 changed files with 8 additions and 6 deletions

View File

@@ -133,7 +133,7 @@ class MeshInterface:
# use id as dictionary key for correct json format in list of nodes
nodeid = n2["user"]["id"]
nodes[nodeid] = n2
infos = owner + myinfo + metadata + mesh + json.dumps(nodes)
infos = owner + myinfo + metadata + mesh + json.dumps(nodes, indent=2)
print(infos)
return infos