Search code examples
asp.netjsonasp.net-mvcasp.net-mvc-4odata

If is reasonable/how to decrease json OData result size


ASP.NET MVC4 WebAPI application has OData controller which returns lot of tablular data in OData v4 format in json to javascript/jquery client in browser:

[Authorize]
public class MyODataController : ODataController
{


    [Queryable]
    public HttpResponseMessage Get(string id, ODataQueryOptions queryOptions)
    {
  ...

Returned result is table which have same columns for every row. It seems that OData requires that every row must have also property specified. Is increases data size with redunant values for every row.

How to fix this so that properties can specified at once for all rows ? For example, maybe json array can used for row data? Or is it OK to return such verbose data? How much it affects to perfomance?


Solution

  • In case I understand your question:

    you can use the $select to return the column what you expect.

    You can use the `$filter' to return the rows what you expect.