The response Receive OData $ metadata in JSON format indicates that OData cannot return metadata as JSON by default.
But is it possible then to capture or track its response for the URL $metadata , and then convert it on the fly to JSON before sending it to the client?
I present the pseudo code as follows:
[HttpGet] [ODataRoute("$metadata")] public string GetMetadataAsJson() { string xml = GetOdataMetadataAsXML(); string json = ConvertToJson(xml); return json; }
I donβt know how to implement it correctly, although, in particular, Iβm not sure how to get the standard OData response as a string and how to include the $metadata URL.
json c # odata asp.net-web-api
sashoalm
source share