Skip to content

feat: unify JSON output format between --json flag and HTML report's report.json #237

Closed

Description

@sonukapoor

The HTML report writes a report.json alongside index.html using the internal ReportData shape, while --json outputs a different structure derived directly from findings. These two formats should be identical so tooling built on one works with the other.

Activity

  1. ELHart05 commented on Jul 18, 2026

    @ELHart05
    Contributor

    I'd like to take this, but since changing --json is a breaking change for anyone parsing it, I want to agree on the target shape with you first.

    Here is where the two differ today:

    • Top-level keys. --json (write-outputs.ts) emits mode, source, findingCount; report.json (the ReportData shape) emits scannedAt, cliVersion, packageManager, lockfileSource. They already share projectPath, packageCount, suggestedFixCommands, notes, warnings, skippedDependencies, and findings.
    • Findings. --json serializes each finding with serializeFinding; report.json uses serializeHtmlFinding, which is the same object plus riskSummary and nextAction.
    • Overrides. --json spreads overrideFindingsToJson(...) at the top level; report.json carries an overrideFindings array. Different shapes.
    • Multi-folder --json has its own separate { multiFolder, folders, findings } shape, which would need to fold in too.

    My suggestion: make ReportData the single canonical schema and have --json emit it (both produced by one builder/serializer path), folding the useful --json-only fields (mode, source) into ReportData so nothing is lost, and settling on one overrides representation (the overrideFindings array). I would also add a schemaVersion field so downstream tooling can detect the change.

    Two questions before I code:

    1. Which way do you want to converge, --json onto report.json (my suggestion), or the reverse?
    2. Are you OK with this being a breaking change to --json now, or would you prefer a deprecation window?

    Happy to open the PR once you have picked a direction.

  2. alex-powell commented on Sep 20, 2026

    @alex-powell
    Contributor

    Working on this.

  3. added 2 commits that reference this issue on Sep 25, 2026
    761b6d4
    a0faf07
  4. added a commit that references this issue on Oct 2, 2026
    0afc051
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions