Search code examples
c#jsonserializationjson-deserializationjsonserializer

Which is better to use for serialization objects? JsonSerializer or JsonConvert


I want to serialize object in c# and learn that we can do this both JsonSerializer and JsonConvert. I know about documentation knowledges about these.

But I want to know which is better to use for serialization objects? JsonSerializer or JsonConvert?


Solution

  • JsonConvert from JSON.net is reportedly better for performance. I actually use it myself and find it very easy to use and works well with attributes in classes. In terms of memory usages it was good for us. The application I work is able to handle around 3500 to 4000 requests including 3 deserialization, 2 http service calls to retrieve data and, one serialization and one service call to push data.. So, in terms of performance it was a great choice.

    http://www.newtonsoft.com/json/help/html/performance.htm (I know, a bit biased, but still) nuget: https://www.nuget.org/packages/newtonsoft.json/