You are not logged in.
Array of variant does not work as a parameter when calling a http interface function of a mormot http server.
I remember I read somewhere that the solution is to transform it to tdocvariant and send it as json
Is that correct?
If so, is there a way to do replace it fast?
I can probably replace the array of Variant with an rawutf8 parameter in the functions and then:
a) use _arr(['aaa',1,5]) to get the a json rawutf8 parameter
b) use _JsonFast or DocList functions inside the called http inteface function to get the array members
Do you propose something else?
Last edited by dcoun (2024-09-01 15:34:47)
Offline
You mean as parameter of SOA service definition with interfaces?
_ArrFast() is certainly the way to go, if you just want to send an array of values..
And it returns a variant, which will be properly serialized and unserialized of the HTTP connection as a JSON array.
Don't use a RawUtf8 parameter: it would be serialized as a JSON string, not a JSON array.
Using a variant parameter is the way to go.
Offline
Thank you a lot @ab.
Offline
Of course, if you prefer, you could use a IDocList parameter.
Perhaps it makes more sense for the end-user of the code: it would be impossible to write anything but a JSON array.
Offline
in case I have a json rawutf8 string (e.g. from a recordsavejson ) when is better to use rawjson and when variant as a parameter type when calling an interface function in a mormot http server?
Offline