Skip to content

Add JSON format for list outputs#6346

Open
PrzemyslawKlys wants to merge 9 commits into
microsoft:masterfrom
PrzemyslawKlys:feature/list-upgrade-json-format
Open

Add JSON format for list outputs#6346
PrzemyslawKlys wants to merge 9 commits into
microsoft:masterfrom
PrzemyslawKlys:feature/list-upgrade-json-format

Conversation

@PrzemyslawKlys

@PrzemyslawKlys PrzemyslawKlys commented Jul 3, 2026

Copy link
Copy Markdown

📖 Description

Adds --format json support for package listing output.

This enables machine-readable output for:

  • winget list --format json
  • winget upgrade --format json when used in list-only mode

The default table output is unchanged.

The JSON output includes installed package fields that match the existing list and upgrade table data, including package name, id, installed version, available version, and source. It also keeps JSON parseable for empty results and common error paths such as source-open failures, WinGet policy blocks, and generic execution failures.

winget upgrade --format json is intentionally limited to non-mutating upgrade listing. Commands such as winget upgrade --all --format json are rejected so package installation progress is not mixed with structured output.

🔗 References

Related to #1753.

🔍 Validation

Added focused test coverage for:

  • JSON list output
  • JSON upgrade-list output
  • empty result output
  • settings warnings before JSON output
  • source-open failures
  • WinGet policy blocks
  • generic execution failures
  • preserving help output for --format json --help
  • rejecting JSON output for unsupported upgrade execution modes
  • rejecting --details with JSON list output

Ran the focused AppInstallerCLITests scenarios for the JSON list and upgrade flows locally.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

@PrzemyslawKlys PrzemyslawKlys requested a review from a team as a code owner July 3, 2026 07:21
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

Successfully merging this pull request may close these issues.

1 participant