TXDataWebClient rawinvoke POST TJSONObject

Hello,

I send a post request to my XData Service :

JSONObj := TJSONObject.Create();
JSONObj.AddPair('id', myID);
[...]
XDataWebClientService.RawInvoke('IMyService.SetNew', [JSONObj],
@myOnResult,
@myOnError);

Service Contract :
[HttpPost] function SetNew(data : TJSONObject): boolean;

it receives this TJSONObject :
Log(data.ToString);

{"fjo$1":null,"FMembers":{"FList":{"FList":[{"fjv":{"fjv":6,"FValue":"","FInt":0,"FInt64":0,"FDouble":0},"fjs":{"fjv":"id","FValue":"id"}},{"fjv":{"fjv":"test","FValue":"test"},"fjs":{"fjv":"titre","FValue":"titre"}},{"fjv":{"fjv":"jc","FValue":"jc"},"fjs":{"fjv":"intervenant","FValue":"intervenant"}},{"fjv":{"fjv":45670,"FValue":"","FInt":0,"FInt64":0,"FDouble":0},"fjs":{"fjv":"date1","FValue":"date1"}},{"fjv":{"fjv":0.700196759259259,"FValue":"","FInt":0,"FInt64":0,"FDouble":0},"fjs":{"fjv":"time1","FValue":"time1"}},{"fjv":{"fjv":45670,"FValue":"","FInt":0,"FInt64":0,"FDouble":0},"fjs":{"fjv":"date2","FValue":"date2"}},{"fjv":{"fjv":0.741863425925926,"FValue":"","FInt":0,"FInt64":0,"FDouble":0},"fjs":{"fjv":"time2","FValue":"time2"}},{"fjv":{"fjv":"","FValue":""},"fjs":{"fjv":"text","FValue":"text"}},{"fjv":{"fjv":"data:image/png;base64,iVBORw0KGgoAA..."},"fjs":{"fjv":"sign","FValue":"sign"}},null,null,null],"FCount":9,"FCapacity":12}}}

Its structure seams to be messy or at least obscure to me... What i'm i doing wrong, if ever ?

Do not use TJSONObject. It's not JavaScript native, it's just a class for backward compatibility with Delphi.

Use TJSObject.

Thanks for your help, indeed the correct object did the job perfectly.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.