Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support System.Text.Json #215

Open
petrsvihlik opened this issue May 3, 2020 · 3 comments
Open

Support System.Text.Json #215

petrsvihlik opened this issue May 3, 2020 · 3 comments

Comments

@petrsvihlik
Copy link
Contributor

petrsvihlik commented May 3, 2020

Blockers

Deserialization of interface types is not supported. - Polymorphic deserialization will be supported in .NET 5

Workaround

Motivation

  • improve performance in high-throughput scenarios
  • reduce the number of non-framework dependencies in the default implementation
  • let users implement decide what deserializer to use

Proposed solution

  • Use System.Text.Json for serialization
  • Adjust code & docs so that it's clear how to implement a serializer of one's choice (some people might want to go e.g. with superfast Utf8Json)

Additional context

Benchmarks

@petrsvihlik petrsvihlik changed the title .NET 5 - preparation Support System.Text.Json Jun 2, 2020
@tomasjurasek
Copy link
Contributor

I found the extension library for System.Text.Json which supports interface deserialization - https://github.com/dahomey-technologies/Dahomey.Json

@petrsvihlik
Copy link
Contributor Author

Some good news:

They plan to extend polymorphic serialization and deserialization: dotnet/runtime#45189

So this feature might become unblocked after .NET 6.

@qpooqp
Copy link

qpooqp commented Dec 10, 2024

Hello.
Just want to ask if there will be any progress on this issue now that System.Text.Json got lots of improvements.

I have models generated by the model generator.
My main problem is interface types in the models. For example i have model with property of type Kontent.Ai.Delivery.Abstractions.ITaxonomyTerm.
I need concrete type for deserialization and i don't like the idea that i should create my own types based on the interfaces. That would mean that i need to keep them up to date with the interfaces when they changes and this is additional work. It would be nice to have some concrete types available.

I was thinking about source generator that would create the concrete types based on the interfaces, but i would prefer to have some "official" solution for me to be able to serialize and deserialize the models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants