2

We are using nSwag and it generates a

Newtonsoft.Json.JsonConverter

attribute on a property, specifically

Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))

Is there anyway to override the attribute at run, to use a different JsonConverter. I've tried adding it to settings.Converters but that does not seem to work.

Tim Bassett
  • 1,325
  • 1
  • 12
  • 23
  • You can use the custom contract resolver from [Anyway to get JsonConvert.SerializeObject to ignore the JsonConverter attribute on a property?](https://stackoverflow.com/a/45644338/3744182) to ignore the applied converter on the property, then add your converter in settings. You may also need to combine that converter with the answer from [C# JsonConvert using the default converter instead of the custom converter](https://stackoverflow.com/q/53401189/3744182) in case an unwanted converter was applied to the type as well as the property. – dbc Dec 16 '18 at 20:15

0 Answers0