Search code examples
odataasp.net-web-api

WebApi Odata: remove metadata from response


I'm developing an WebApi Odata service for internal usage. I want to remove from response at server all additional data except serialized data. I want to remove all this stuff:

{
  "@odata.context":"http://192.168.150.86:9933/odata/$metadata#Terminal","value":[

  ]
}

and leave here only array of "Terminal"

is there any way to do this?


Solution

  • Add the following option to your query string:

    $format=application/json;odata.metadata=none
    

    This will remove the odata metadata from your results.