If I use HandleByQuery or HandleBySqlStatement I get have a resulting json which reflects the DB structure.
Now I need to provide a REST API for querying some date in the IdentityManager and I want to use my own DateStructure for the resulting json.
As simple example I've done this:
builder.AddMethod(Method.Define("eset") .HandleGet(async qr =>{ Query q = Query.From("ESet").Select("Ident_ESet").Where("UID_ESetType = N'e65d9baa-d737-4de9-a005-2f1f8f6263c8'"); var entityRead = await qr.Session.Source().GetCollectionAsync(q); ESetList esets = new ESetList(); foreach (var eset in entityRead){ esets.esets.Add(new ESet() { Ident_ESet = eset.GetValue("Ident_ESet") }); } return esets; }));}
Now the Result looks like:
{ "Result": { "esets": [ { "Ident_ESet": "xxxx" }, { "Ident_ESet": "yyyy" }, { "Ident_ESet": "zzzz" ...
How can I get rid of the "Result:" entry?
I just need:
{ "esets": [ { "Ident_ESet": "xxxx" }, { "Ident_ESet": "yyyy" }, { "Ident_ESet": "zzzz"
...
Or is there an easier way to do the request from scratch?