diff --git a/src/licensedcode/match.py b/src/licensedcode/match.py index 7d7880606e..910d12caad 100644 --- a/src/licensedcode/match.py +++ b/src/licensedcode/match.py @@ -768,9 +768,11 @@ def to_dict( Return a "result" scan data built from a LicenseMatch object. """ matched_text = None + matched_text_diagnostics = None + if include_text: if license_text_diagnostics: - matched_text = self.matched_text(whole_lines=False, highlight=True) + matched_text_diagnostics = self.matched_text(whole_lines=False, highlight=True) else: if whole_lines: matched_text = self.matched_text(whole_lines=True, highlight=False) @@ -795,6 +797,8 @@ def to_dict( if include_text: result['matched_text'] = matched_text + if license_text_diagnostics: + result['matched_text_diagnostics'] = matched_text_diagnostics return result def get_highlighted_text(self, trace=TRACE_HIGHLIGHTED_TEXT):