0
votes

My web api action returns an entity in odata json format such as is:

{
  "@odata.context":"http://x/odata/$metadata#Category","value":[
   {
      "Id":734,"Number":"100","Description":"category description"
   }]
}

Before using OData, I had my action return in JSON format, so I used to get the response like this:

var result = response.Content.ReadAsAsync<T>().Result;

However this method doesn't work anymore for OData JSON. How do I get to deserialize the result into my object?

1
You could use a native client and make the transactions by linq - Leandro Bardelli
Im not really sure why it matters if its an OData json or a simple JSON. They both adhere to the JSON standard? - Yuval Itzchakov
The OData json example above cannot be deserialzed into the object. - Ivan-Mark Debono

1 Answers

0
votes

There are several client libraries that will do the job for you. You can try OData Code Generator VS extension or Simple.OData.Client.