Hello,
I'm trying to write a XData Server that must expose some API that can be consumed by various Client in different languages.
I want to use JSON as standard, so I taught it could be sufficient send to the service a JSON formatted string as Parameter (for example: {"Value": {"Username":"gs","Password":"gs"}}) that I could deserialize server-side, but I noticed that there is some issues doing like this: using the Delphi Built-in REST Debugger, if I use this JSON as body, I get a TJsonTypeConverter.EConvertFromJsonError with message 'Cannot read JSON property of type "string", invalid value.'; if I invoke the service as usual using XDataClient with the same parameter, the JSON that is sent it's something like this:
{"Value":"{"Value": {"Username":"gs","Password":"gs"}}"}.
Using the parameter attribute [FromBody] I've been able to send correctly the JSON on the request, but the response is like this (it could be an array of objects):
{
"value": "[{"Id":1,"Username":"gs","User_Password":"gs","Active":true,"Company":"Galeno Sistemi srl","First_Name":{},"Surname":{},"Company_Address":{},"City":{},"Country":{},"Email":{},"Phone":{},"Mw_Sn":{},"Mw_Exp_Date":{},"Is_Active":{},"Deleted":{},"Registration_Date":{},"E2E_TP_USER":{"Id":1,"Description":"Cliente","Tp_Code":"CLI"},"E2E_GROUPList":[],"E2E_AFFILIATIONList":[]}]"
}
Is there any way to send to and receive from server a standard JSON that can be used or it's necessary to add backslash every time there is a double quote char when I send to server a JSON string param and delete it when the client receive the response?
Thanks in advance