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

JSON output for some commands #1252

Open
majkinetor opened this issue Apr 15, 2017 · 8 comments
Open

JSON output for some commands #1252

majkinetor opened this issue Apr 15, 2017 · 8 comments

Comments

@majkinetor
Copy link

It would be great for choco to return something other then text for any output. JSON would totally do as it can quickly be loaded with Convert-FromJson. This would help with automatic choco installation and configuration.

For example:

choco info git.install --format json | Convert-FromJson | % Tags

choco feature --format json | Convert-FromJson | set features
$features.checksumFiles.Enabled -eq $true
@ferventcoder
Copy link
Member

This might be a duplicate as it may already have another coinciding issue.

@ferventcoder
Copy link
Member

Actually seeing output as JSON format I think was once proposed but would require quite a bit of rework to allow. However it may not be a bad idea to look at it for some commands.

How easily can command output (text) pipe to PowerShell's Convert-FromJson? Since the output on the left doesn't come out as a PowerShell object (and it can't being a command that is run, not a PowerShell script), is what you are showing even technically possible in that form?

@majkinetor
Copy link
Author

majkinetor commented Apr 19, 2017

Yes it is possible, as long as it is valid json.

@ferventcoder
Copy link
Member

That's pretty cool then. :D

@ferventcoder ferventcoder changed the title Machine readable output format for commands JSON output for some commands Apr 19, 2017
@ferventcoder ferventcoder added this to the 1.x milestone Apr 19, 2017
@ferventcoder
Copy link
Member

I've marked this up for grabs.

@majkinetor
Copy link
Author

Its also usable with jq (cinst jq):

gsv | convertto-json | jq .[].Name

@Daniel15
Copy link

Daniel15 commented Dec 2, 2018

Possibly a duplicate of #159?

@jborean93
Copy link

This would be a great thing to have. Would solve #1614 as the .NET library for JSON will be able to escape whatever character for you.

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

No branches or pull requests

4 participants