0

I have an OData api where we need to serialize DateTimes differently. For example, some properties need to be yyyy-mm-dd, yyyy-MM-dd HH:mm:ss or yyyy-MM-dd HH:mm, etc.

I have read the following articles:

Plus a bunch of other searching online and trying different patterns but I cannot seem to get it to work. Basically all of those patterns treat all DateTimes the same. I need to be able to say if propertyName = "CalendarDate" serialize this way, if propertyName = "DateTimeIncludeSeconds" serialize that way, etc.

Any thoughts on how to conditionally set the format for DateTimes on a property by property basis in a .Net Core 3.1 OData api?

zgirod
  • 4,189
  • 3
  • 28
  • 36
  • You might want to check https://stackoverflow.com/questions/20656229/json-net-as-a-webapi-2-odata-serializer-vs-odatamediatypeformatter – Chetan Jun 29 '21 at 02:27
  • @ChetanRanpariya thanks checking it out today, will see if that can help push in the right direction – zgirod Jun 29 '21 at 19:44

0 Answers0