System.Text.Json Json serialization / deserialization fails
See original GitHub issueDescription Stylet/PropertyChangedBase.cs is missing the attribute [System.Text.Json.Serialization.JsonIgnore] to make classes serializable and deserializable.
To Reproduce
public class Test : Stylet.PropertyChangedBase
{
public string TestString {get; set; }
}
can be serialized, but has a "PropertyChangedDispatcher": {}
object which can’t be deserialized.
Version Info
- Stylet version: 1.3.6
- Runtime version: 6.0.1
**Solution **
[System.Xml.Serialization.XmlIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public virtual Action<Action> PropertyChangedDispatcher
{
get { return this._propertyChangedDispatcher; }
set { this._propertyChangedDispatcher = value; }
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
System.Text.Json Deserialize Fails - net core
I was getting an error about Unable to Parse without a parameterless constructor. I have since fixed that, but now my objects are...
Read more >System.Text.Json fails to deserialize into a model with an ...
Text.Json serializer. While the code appears to be a valid application of the general principles of System.Text.Json, it fails in practice. It ...
Read more >System.Text.Json - can't serialize exception #43026
Description We're trying to use System.Text.Json for serialization and deserialization inside our API project with GraphQL.
Read more >How to serialize and deserialize JSON using C# - .NET
This article shows how to use the System.Text.Json namespace to serialize to and deserialize from JavaScript Object Notation (JSON).
Read more >Migrate from Newtonsoft.Json to System.Text.Json - .NET
Newtonsoft.Json can serialize or deserialize numbers represented by JSON strings (surrounded by quotes). For example, it can accept: {" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could serialize only what you want. Just mark your class with
[JsonObject(MemberSerialization.OptIn)]
and properties to serialize with[JsonProperty]
.For more info see docs
(this will be closed when the next release is merged)