return clean json Actionresult controller

I have this acion

public async Task<ActionResult> Get(short Y, string r)     {         var items = await _tRepository.Get(Y, r);         return Ok(items);     } 

the problem is that json i send to the client contains the parameter "items"

{"items":[{"k":9995,"y":"yyy"},{"Y":9934,"y":"xxx"}]} 

i want to send the client clean json

Add Comment
1 Answer(s)

It depend on your items type and if you need to return just array or list without items property, you must use return Ok(items.Items);

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.