Page 3 of 3

Re: Overriding default servicestack serializer

PostPosted: Thu Jun 01, 2023 12:48 pm
by pricerc
I think Newtonsoft is a bit more flexible/forgiving than ServiceStack, and that is definitely true of the stock .NET Framework and .NET Core JSON libraries.

Newtonsoft also includes XML <-> JSON conversion functions.

Re: Overriding default servicestack serializer

PostPosted: Thu Jun 01, 2023 4:22 pm
by Mike.Sheen
pricerc wrote:I think Newtonsoft is a bit more flexible/forgiving than ServiceStack, and that is definitely true of the stock .NET Framework and .NET Core JSON libraries.

Newtonsoft also includes XML <-> JSON conversion functions.


The author of Newtonsoft JSON.NET, James Newton-King, is a Kiwi so you're obligated to say that - being a Kiwi yourself and all :P

Seriously though, I've seen a lot of contributions by James in the .NET repos around JSON serialisation - so he's actively involved in the built-in .NET JSON functionality as well... Maybe all those features of Json.NET will end up in the standard .NET serialisers.

Anyway, the plugin I provided yesterday enables you to use Json.NET instead of ServiceStack for serialisation - deserialisation would be pretty much the same.

Re: Overriding default servicestack serializer

PostPosted: Sat Jun 03, 2023 11:14 pm
by pricerc
Mike.Sheen wrote:The author of Newtonsoft JSON.NET, James Newton-King, is a Kiwi


I honestly didn't know that. (or if I did, I'd forgotten...)

But I think he was/is actually in charge the .NET core one (might still be, I'm too lazy to look for it).

But the "formal" libraries also have an expectation of sticking closer to "formal" standards, whereas a "pure" open-source library can be a bit more flexible and work better with dodgy data that you find "in the real world". E.g. comments aren't supposed to exist in JSON, and so some libraries choke on them (including the .NET core one, I think), but Newtonsoft copes with them.