Open murph opened 3 years ago
Hey, When you run a command like "hue -j lights 1,2" the output looks like this:
{ "name": "Light One" ... } { "name": "Light Two" ... }
While this is two valid JSON objects, the whole result isn't a valid JSON object. This makes it difficult to parse the output with many JSON libraries, including python's json.loads.
json.loads
Two options that might make it easier to handle:
1) Output an array of results
Something like:
[{ "name": "Light One" ... }, { "name": "Light Two" ... }]
2) Output one-result-per-line
{"name": "Light One", "state": ... } {"name": "Light Two", "state": ... }
While it's still technically invalid, it's at least easy to split the file on newlines.
Hey, When you run a command like "hue -j lights 1,2" the output looks like this:
While this is two valid JSON objects, the whole result isn't a valid JSON object. This makes it difficult to parse the output with many JSON libraries, including python's
json.loads
.Two options that might make it easier to handle:
1) Output an array of results
Something like:
2) Output one-result-per-line
Something like:
While it's still technically invalid, it's at least easy to split the file on newlines.