-
Notifications
You must be signed in to change notification settings - Fork 273
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
JSON output option #190
Comments
Great idea. I've been thinking along the same lines. The existing output formatting is very ad-hoc and inconsistent between commands without much design behind it. App names can sometimes be quite long due to SEO efforts and thus parsing errors could arise even with the existing formats if numbers and special characters are embedded. I want to add a formatting layer so that the various supported formats can easily be toggled. Is the a specific use case you are looking to automate? Are there any attributes that you would like to see added? The current text output doesn't lend itself to including a lot of data, but this output could be a lot more verbose in JSON as it doesn't need to fit easily on a terminal screen. |
I'm working on a SaltStack module/state for automating the management of Mac App Store applications. (That is the reason of my comment in #89) Your At the moment, I don't have found any situation in which I have needed more information than the three parameters requested. Although, by returning a JSON, more information could be added later without breaking the API. |
Hi! Is there any progress on this issue?? |
It would be neat to have a |
Maybe the Should error or warning messages also be output as json? Or could we limit json to stdout, while using normal text logging messages for stderr? |
I'm fine with this, as long as we have a way to retrieve installed apps in JSON format. |
@cdalvaro Thanks. Also, I would default to outputting all the data from any JSON we obtain, rather than filtering out values. Filtering can be done by piping stdout to The results we get seem to be in standard JSON, not abbreviated JSON5. Should we ensure it's proper JSON, or just return what we get? If somehow invalid JSON, easiest to just output it to stderr, unless we see a consistent incorrect formatting that can be deterministically massaged into valid JSON. I also assume that we shouldn't sort the JSON files. Let me know if you disagree. |
I'm happy with that! To avoid format issues, the best is to redirect everything to stderr except the json itself, when the json option is present. |
@cdalvaro Agreed. Thanks. |
See #63 (comment), which includes a discussion of different field names from different sources used for different commands (like |
It would be nice to have a parameter like
--json
when listing or searching apps.I have tried to parse the current output, which is not very difficult, but it can stop working at any time if the output format is changed.
This could help to create an API for automation.
For example, instead of:
get something like:
The text was updated successfully, but these errors were encountered: