supress value - construct

I have my own Xdata-service

  TExhLead = class

TExhLeadList = TList<TexhLead>;

[HttpGet] function exhleads:TExhLeadList;

How can I supress the value construct in the output?

The function above returns a list of objects and not an object with a list inside. IMHO the { 'value' : ....} construct is wrong but I can not find the switch for the right output

Is there any way to do so? My consuming API don't expect an extra node.

Best regards

For now you can't disable it, unless you return a TJSONArray with the raw JSON array you want to return.
Or, you can return a TStream and then provide the raw JSON value you want to provide as the stream content.

Wagner, thanks for the hint.

What I do not understand. You took features of odata in xdata but at the end you invested a huge time/energy/money for an incompatible xdata protocol. Is there any plan to to say: xdata will use odata as export protocol? May be due an additional interface?

In the same time a lot of new possibilities will start. xdata server can be producer fore all odata consumers. Currently xdata is locked in in the delphi (tms) system.. Or you use the hint above.

That is absolutely false.

XData REST API server uses standards like HTTP, JSON, JWT, OpenAPI, Swagger, OAuth2 and OpenID Connect and many other that are interchangeable with virtually all development platforms and languages. Actually I dare to say that it's the Delphi API framework that more adheres to standards.

XData servers can be easily used and accessed from anywhere, and users actually do that. You can access it from PHP, C#, Java, web clients like React, Angular, etc.. It's in no way absolutely locked into Delphi system and even more in TMS system.

It is not OData compatible, though, correct. OData is a white elephant, a big and complex standard that maybe only Microsoft (the author) fully complies to.

Even then, XData actually is again maybe the only Delphi framework to resemble OData features and be compatible with some of them, even complex ones like $filter and other URL query options.

1 Like