Which is better to use for serialization objects? JsonSerializer or JsonConvert [closed]
Asked Answered
I

2

6

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?

Ichthyology answered 12/8, 2016 at 10:12 Comment(3)
And your question is...? Can you provide some sort of context? Completely unclear what you're asking...Glen
now you understand that question?Ichthyology
This question is unfortunately off-topic due to the site policy of not allowing questions which ask for recommendations. The term "better" is subjective and prone to being opinion-based, something which is also off-topic. Without a much clearer question both the question and potential answers is going to be off-topic for this site. If you can reword it it may be on-topic. A tip would be to simply test both, or at least one of them and if you encounter something that doesn't work come back and ask about that.Chamorro
G
4

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/

Gunk answered 12/8, 2016 at 10:33 Comment(1)
I've also got some "circular reference" errors when using JsonSerializer with some structs, while JsonConvert handles them successfully without extra effort.Tip
R
-3

"JsonConvert" is good for Small Project but for more than 4000 request and big Project with massiv Data, become "Memory out of exception" Error!!

then you have to use "JsonSerializer "

Router answered 27/3 at 10:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.