You are not logged in.
Pages: 1
Hello,
I am using Delphi 10.3, mORMot SynopseCommit.inc value '1.18.6244'
I could not figure why I get FAILED! message for following simple JSON string
{
"optionUuid": "57202ea4-cc62-4eff-bbea-fa5be41449ee",
"optionName": "Tuzsuz",
"optionPrice": 5.2,
"isSelected ": true
}
Using a code like below:
TOrderProductNote = packed record
optionUuid: string;
optionName: string;
optionPrice: Double;
isSelected: Boolean;
end;
procedure TForm2.Button1Click(Sender: TObject);
var
Response: TOrderProductNote;
TempString: string;
begin
TempString := '{"optionUuid": "57202ea4-cc62-4eff-bbea-fa5be41449ee","optionName": "Tuzsuz","optionPrice": 5.2,"isSelected ": true}';
if not SynCommons.RecordLoadJSON(Response, RawUTF8(TempString), TypeInfo(TOrderProductNote)) then
ShowMessage('FAILED!')
else
ShowMessage('OK');
end;
My debugging, I see de-serialization fails on "isSelected", but I could not understand why.
Any help is appreciated.
Thanks & Regards,
Ertan
Offline
Nevermind, just figured, right after I post that there is a space character in raw JSON string for
"isSelected "
Cost me a lot of time until I could actually see that.
Sorry for the noise.
Offline
Pages: 1