1

I recently read up on Jil, claiming to be the faster Serializer than JSON.Net.

I would like some help on creating a Customer MediaTypeFormatter for Jil.

Take note: I'm using .NET framework 4.7.1

Any advice for codes to make Jil able to have such codes as well?

config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;

((DefaultContractResolver) config.Formatters.JsonFormatter.SerializerSettings.ContractResolver).IgnoreSerializableAttribute = true;
config.MessageHandlers.Add(new Library.Api.Authentication.Logs.LogRequestAndResponseHandler());

config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("multipart/form-data"));

Therefore, I want to try replacing JSON.Net with Jil as the Default Serializer for my WEBAPI.

Here are some references that helped me --> [1] & [2]

dbc
  • 104,963
  • 20
  • 228
  • 340
  • 1
    Please update your question so that it shows **your** relevant code in a [minimal, complete, and verifiable example](https://stackoverflow.com/help/mcve). It would also be helpful if you could let us know [what you have tried so far](https://meta.stackoverflow.com/questions/261592) to solve your problem. For further information, please refer to the help article regarding [how to ask good questions](https://stackoverflow.com/help/how-to-ask) and [take the tour](https://stackoverflow.com/tour). – wazz Mar 15 '18 at 05:43
  • Take a look at [Jil serializer ignore null properties](https://stackoverflow.com/q/35267108/3744182). That should answer the first part of your question. As for `[Serializable]` and `IgnoreSerializableAttribute` do you have any reason to believe that [tag:jil] respects this attribute? The [docs](https://github.com/kevin-montrose/Jil) state *Jil deserializes public fields and properties;* which implies that Jil ignores this attribute. – dbc Mar 15 '18 at 19:24
  • Given that you have already implemented a basic `Jil MediaTypeFormatter` as shown in http://blog.developers.ba/replace-json-net-jil-json-serializer-asp-net-web-api/, I'd suggest breaking this down into separate questions about how to implement each required Json.NET setting using Jil. As it is the question looks too broad especially since you don't share the working code you have so far. – dbc Mar 16 '18 at 23:56

0 Answers0