XData Servicefunction Result JSONObject with TList<T> inside

Hello Wagner,

I have a service function

function Search ( const Param: TJSONObject) : TList<TKunde>;

This works.
But I want to change the function to

function Search ( const Param: TJSONObject) : TJSONObject;

In the TJSONObject I would like to have the following:

{ "Data1": Value1,
  "Data2": Value2,
  "MyList": TList<TKunde>}

Do you have a ready function that turns TList<TEntity> into a JSON object?

  MyList: TList<TKunde>;
  MyObject: TJSONObject;
  MyList := (intern function Aurelius).List;
  MyObject := [?? Serialize ( MyList) as JSONArray/JSONObject ??]

Best regards

The URL parameters $expand and $select should be considered during conversion.

Hi Thomas,

Unfortunately not, there isn't such function available. I'm afraid you will have to do it manually.