System.Text.Json

Posts   
 
    
hostileant
User
Posts: 9
Joined: 14-Feb-2017
# Posted on: 14-Aug-2020 02:17:49   

Hi Team,

We have an dotnet core web api that we use LLBLGen Adaptor with. Everything works perfect.

I was hoping to explore the performance benefits of migrating from Newtonsoft to System.Text.Json (STJ) for serialization.

Instructions for preventing Newtonsoft serializing the internal LLBLGen properties has been available since forever and works fine.

https://www.llblgen.com/documentation/5.2/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/Distributed%20systems/gencode_webservices.htm#json-support

Sadly it seems that Microsoft's STJ library lacks a massive chunk of Newtonsoft's functionality

https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to

It has no official support for the serializer settings that are required to serialize LLBLGen entities.

Have you looked at whether it be possible to support serializing with STJ or are dependent on MS expanding the feature set of STJ?

Thanks

Ant

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 14-Aug-2020 09:07:19   

Hi Ant,

Did you tried already?

Indeed it seems very limited in "flexibility" compared to Newtonsoft. Howerver I see that there are workarounds for certain cases. So maybe it would be worth to try it.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 14-Aug-2020 09:10:31   

I think one big limitation of the new system.text.json is that it doesn't do cyclic dependencies. It's a library that's great for serializing a one-way referenced tree or single objects, but for a graph of objects, json.net is still required.

We've built in serialization support for binary formatter and xml. As that's a serious piece of code that sadly isn't aging very well, considering binary serialization and xml are both considered 'legacy' we decided not to add native json serialization to our framework but rely on an external library. json.net works for that.

the system.text.json library at the moment does not. I'm not familiar with MS' plans to extend the featureset of it however, but as json.net works, for the time being you should use that. I know the performance is lower, but it's the one that works atm.

Frans Bouma | Lead developer LLBLGen Pro