So one of the base libraries over the years that has been our friend is Newtonsoft.Json – the stuff of legend maybe? Well, if not, certainly anyone whose done .Net and used any kind of Json formatted data certainly knows of Newtonsoft.Json… The “go to Json Serializer”! That is until Microsoft set out to prove to the world they could do it better. Better?
Like many things in the world of .Net over the years, Microsoft watches these open source libraries… and notices when they become the defacto standard (meaning… Micro either left it out of their core offerings…. or more typical someone did better). Hence Microsoft’s System.Text.Json vs. NewtonSoft.Json. Oh let the confusion begin!
Now to Microsoft’s credit they have been working to finally bring System.Text.Json up to speed… but of course they continue to state the their intent is not to bring their Json library up to par with Newtonsoft. And there it is… the two world Json library view… now mostly the complaint I have deals with migrating old code up to using Microsoft’s. It’s a bit of a “rub me the wrong way” kind of careful reading as to which direction to take. Why? Well you get into dependency issues where Newtonsoft and Microsoft’s library don’t always play well together- that can be a problem when it comes to wanting to use old code (NewtonSoft) in a new app while wanting to take advantage of faster MS .Net 5 serializations….. Yeah, why would one ever want to do that?
Anyway, I take some time to read a great article @
Layomi has a great write up of things to consider… especially in the section “Choosing between…” the two different libraries…. It’s a good read.