Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching information on multiple lights (hue lights 1,2) with json output returns multiple json objects #31

Open
murph opened this issue Aug 30, 2021 · 0 comments

Comments

@murph
Copy link

murph commented Aug 30, 2021

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.

Two options that might make it easier to handle:

  1. Output an array of results

Something like:

[{
  "name": "Light One"
   ...
},
{
  "name": "Light Two"
  ...
}]  
  1. Output one-result-per-line

Something like:

{"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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant