public static void ConvertRptToJson(Stream reportBinary, Stream reportDefinition) { using (var temporaryFile = new TemporaryFile()) using (var report = new ReportDocument()) using (var jsonw = new Utf8JsonWriter(reportDefinition, new JsonWriterOptions { Indented = true })) { temporaryFile.CopyFrom(reportBinary); report.Load(temporaryFile.FilePath, OpenReportMethod.OpenReportByTempCopy); jsonw.WriteStartObject(); ReportClientDocumentModel.ProcessReport(report.ReportClientDocument, jsonw); jsonw.WriteEndObject(); jsonw.Flush(); } }