You are not logged in.
Pages: 1
Hello,
There is this java web service which is requesting and responding using the identical JSON format.
I have below record definition. That record is serialized and sent to the web service. There is no problem and it consumes it.
THuginTPSSaleOrderSaleItem = packed record
Quantity: Double;
Amount: Double;
PLUNo: Integer;
DepartmentId: Integer;
VatRate: Double;
end;
But, the web service is responding something like below
{
"Quantity": "2.00",
"Amount": "10.00",
"PLUNo": 1,
"DepartmentId": 1,
"VatRate": 0,
}
As you can see the web service respond has some numbers as double quoted (aka string).
I wonder if mORMot2 can de-serialize these numbers in double data type as defined in the record.
If it is possible, I do appreciate a small RecordLoadJson() example showing how I can build necessary parameters and pass them to the function.
Thanks & Regards,
Ertan
P.S. Both record and json examples are greatly minimized for keeping this post short.
Offline
I wonder if mORMot2 can de-serialize these numbers in double data type as defined in the record.
If it is possible, I do appreciate a small RecordLoadJson() example showing how I can build necessary parameters and pass them to the function.
mORMot can deal with such formatted JSON string. Here is demonstration code for using RecordLoadJson() to process it.
Offline
I didn't know that mORMot2 has such ability and also that it is turned on by default.
I spotted that I missed several breaking format differences in the web service response.
Sorry about the noise.
Last edited by ertank (2024-10-28 18:29:01)
Offline
Pages: 1