Should API projects generated with arcus-webapi template use Newtonsoft.Json instead of Json.Text #277
Unanswered
stijnmoreels
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Not sure if this is still relevant, but from your text above I only see upside to using Newtonsoft.Json as the JSON serializer, are there any downsides to using Newtonsoft.Json as the JSON serializer? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@fgheysels :
It seems that the new Json.Text serializer that is used by default in ASP.NET has a lot of limitations as opposed to the Newtonsoft.Json serializer.
I'm wondering if we shouldn't specify the Newtonsof.Json serializer for projects that are created with arcus-webapi.
Some limitations where I ran into today:
no out of the box support to serialize/deserialize Timespan types. You have to create your own converter for it. (Not such a big issue but ...)
No support for EnumMember attributes to control how enum values should be serialized. There is a workaround for it, but it's yet another external package.
Swashbuckle example's don't seem to work well when using the Json.Text serializer as well. When creating custom examples for a type which has enum properties, those enum-values are not serialized as a string although you have specified that enums should be formatted as a string. (Ok, this is most likely a problem in Swashbuckle.Filters, but it is confusing :) ).
So the question is, should we make sure that we use Newtonsoft.Json as the JSON serializer by specifying:
Original issue: #159
Beta Was this translation helpful? Give feedback.
All reactions