diff --git a/pkg/printers/json.go b/pkg/printers/json.go index 6ffa996fb0e4..d68b82c2f3bf 100644 --- a/pkg/printers/json.go +++ b/pkg/printers/json.go @@ -30,6 +30,9 @@ func (p JSON) Print(ctx context.Context, issues []result.Issue) error { Issues: issues, Report: p.rd, } + if res.Issues == nil { + res.Issues = []result.Issue{} + } outputJSON, err := json.Marshal(res) if err != nil {