You are not logged in.
Hello,
I am using Delphi 10.3.2, targeting Win32 executable.
I had that legacy code of mine working fine until some days ago. I am told that it is giving some json error. My comparison showed me that server side has a minor change in their sent out json. BeyondCompare screen looks like following:
https://imgur.com/u28x5uN
Left side in above picture is version that is working fine. Right side is version that is failing. Basically below fields are moved up before an array in json string:
"PaymentCheck":null,
"PaymentAcikHesap":null,
"HataDuzeltTutari":0.000000,
"FaturaliSatisTutari":0.000000,
"CariHesapAdedi":null,
My record definitions are as following:
TZTax = packed record
TaxKDV: string;
TaxAmount: Variant;
TaxRate: Variant;
TaxIndex: Variant;
end;
TZReportItem = packed record
Idx: Int64;
Terminal: string;
EkuNo: Integer;
ZNo: Integer;
ZDate: TDateTime;
ZTime: string;
KumuleTutar: Double;
KumuleVergiKDV: Double;
GunlukToplamTutar: Double;
GunlukToplamKDV: Double;
YuzdeArttirimAdedi: Variant;
YuzdeIndirimAdedi: Variant;
IptalAdedi: Variant;
HataDuzeltAdedi: Variant;
MaliFisAdedi: Variant;
MaliOlmayanFisAdedi: Variant;
MusteriFisAdedi: Variant;
IptalFisAdedi: Variant;
SatisIptalFisAdedi: Variant;
FaturaliSatisAdedi: Variant;
YuzdeArttirimTutari: Variant;
YuzdeIndirimTutari: Variant;
NakitTutari: Variant;
KrediTutari: Variant;
IptalTutari: Variant;
FoodSaleCnt: Variant;
FoodRcptTotalAmount: Variant;
OtoparkEntryCnt: Variant;
InvoiceOtherPayment: Variant;
OtherPaymentTotalAmount: Variant;
AvansIslemSayisi: Variant;
Avans: Variant;
KasaOdeme: Variant;
FiscalReportReceiptCnt: Variant;
TasnifDisiReceiptCnt: Variant;
InvoiceCash: Variant;
MobilPayment: Variant;
TaxRefund: Variant;
TaxlessAmount: Variant;
TaxlessCount: Variant;
CreditInvoice: Variant;
PaymentGift: Variant;
PaymentTreat: Variant;
PaymentFree: Variant;
PaymentDeposit: Variant;
PaymentPoint: Variant;
PaymentExpense: Variant;
InvoiceTotal: Variant;
EInvoiceTotal: Variant;
EArchiveInvoiceTotal: Variant;
BankaTransferTutari: Variant;
PaymentCheck: Variant;
PaymentAcikHesap: Variant;
HataDuzeltTutari: Variant;
FaturaliSatisTutari: Variant;
CariHesapAdedi: Variant;
ZTaxList: TArray<TZTax>;
TaxRate0Amount: Variant;
TaxRate1Amount: Variant;
TaxRate8Amount: Variant;
TaxRate18Amount: Variant;
TaxRateOtherAmount: Variant;
Currency: string;
OKCVersion: Variant;
end;
TResponse = packed record
IsSummary: Boolean;
ZReportItems: TArray<TZReportItem>;
UniqueId: Variant;
ErrCode: string;
ErrDesc: string;
end;
I am not using TTextWriter.RegisterCustomJSONSerializerFromText() as I do use all fields in that json string.
I know that I can do same change on my record definitions and everything will be back to normal. However, I do really would like to have some flexible code because such changes on server side is going to happen more and more.
My question is: Is there anything that can be done to ignore position of fields in json string in my specific case?
Thanks & regards,
Ertan
Offline
Hello,
I found that there is an additional field at the very bottom of that several KB long json string. So, it is not a problem of fields changing their position in json string but an addition of a field.
Now I need to use that TTextWriter.RegisterCustomJSONSerializerFromText() not to have such a problem again.
Thanks & regards,
Ertan
Offline