Basic JSON output
Intends to fix #30 (closed) by adding a --json flag. This should make the output easier to consume from a script, e.g. ansible. The output currently looks like this:
$ json2tango --json /tmp/test.json
{
"devices": {
"fisk/fisk/fisk": {
"added": true,
"server": "Fisk/fisk",
"device_class": "Fisk",
"properties": {
"fisk": {
"value": [
"fisk",
"fisk"
],
"old_value": null
}
}
},
"sys/tg_test/6": {
"deleted": true,
"server": "TangoTest/test",
"instance": "test",
"device_class": "TangoTest",
"properties": {}
},
"sys/tg_test/1": {
"attribute_properties": {
"ampli": {
"max_alarm": {
"old_value": [
"10"
],
"value": [
"100"
]
}
}
}
}
},
"classes": {}
}
This shows adding/removing a device, and changing an attribute property. The output format is simply the internal format used as input to the "human readable" diff output. It may not be optimal for other use cases, but should be pretty easy to modify.
Once agreed on the output format, I will also add some tests.