Reputation: 1109
I am working on an application where I want to serialize a large data set object. The problem is that it serializes the object very slowly and my file uploaded on FTP is incomplete JSON. Here is my code.
var warrantyRecord = JsonSerializer.Serialize(warrantyData.WorkOrders);
using var stream = toStream(warrantyRecord);
var fileUploadPath = _kubotaHistoryOptions?.RootPath + getKubotaInvoiceHistoryFileName(location.Item1);
await _iFtpClientService.SendFileAsync(_kubotaHistoryOptions?.FTP, stream, fileUploadPath);
When I go and check the file it is always incomplete. When I try to debug my code check for variable warrantyRecord it seems like data is still loading and it takes to time to serialize the whole object. My Json always looks like this at the end. From start it is good the ending tags are always missing.
...."Cost":52.0097,"Price":58.6600,"LineAmount":58.66000000,"Discount":0.0000,"SaleTax":0,"LineTotal":58.66000000},{"LineID":"4","LineType":"Core Ret","ItemNumber":"66-17R","ItemDesc":"Tire","Quantity"
Upvotes: 1
Views: 98