Fixed an issue in generating clean-up JSON file when the downloaded file contains a credit/debit notes linked with invoices.