Comments (2)
The error is because all the deserializer knows is that the deserialization target type for some json object(s) is the interface IEpisodeSaveData
which obviously is not type that can be instantiated. The deserializer also doesn't start reading the tea-leaves, trying to guess what you expect it to do with this dictionary having IEpisodeSaveData
as its value type. So, it basically says "Nope. I have no clue what you want. No soup for you."
Your best way forward is probably to let the serializer put type metadata into the serialized json data, so the deserializer will know from this metadata which types to create. To do this, you will not only have to use TypeNameHandling = TypeNameHandling.Auto
for the deserializer, but you will also have to use it for the serializer.
(the issue lies solely in the "eventFlags" prop)
No, it doesn't. It lies chiefly with the Dictionary<Character, IEpisodeSaveData> episodes
dictionary. Note that once the deserializer would know which concrete IEpisodeSaveData type to use for a given json object, it would automatically also know the concrete Dictionary<T, bool> eventFlags
type, because the concrete type for T
is part of the type definition of the concrete IEpisodeSaveData classes. :-)
from newtonsoft.json.
Yeah that seemed to have fixed it ! Thanks !
from newtonsoft.json.
Related Issues (20)
- Json.NET deserializes nested types using only the last entry in the nested array HOT 2
- error CS0104: 'Func<,>' is an ambiguous reference between 'Newtonsoft.Json.Serialization.Func<T, TResult>' and 'System.Func<T, TResult>' HOT 5
- Exception during deserialization with TypeNameHandling = TypeNameHandling.All a json that was saved by browser HOT 2
- Could not determine JSON object type for type System.Collections.Generic.KeyValuePair HOT 1
- Unity cyclic references of Unity objects HOT 2
- NullReferenceException in JsonSerializer.GetMatchingConverter(IList<JsonConverter> converters, Type objectType) HOT 7
- Ignoring JsonProperty Name HOT 2
- [Enhancement] when serializing/deserializing a netstandard lib used in .net framework/ net core
- JsonConvert.DeserializeObject appends value for no reason HOT 2
- Ask for the "PrivacyInfo.xcprivacy" required by Apple
- [Bug] CreateProperties adds JsonIgnore fields when it should not MemberSerialization.OptOut HOT 2
- Problem with Deserialize number like 0...8 and 0...9 HOT 2
- deserialize object Ignore case HOT 1
- Deserializing object of missing class as it's Base class (C#) HOT 1
- Source code version problem HOT 1
- [Feature Request] MissingMemberHandling attribute HOT 4
- JsonConvert.DeserializeObject using $type does not (at least for the root object) not use the converter HOT 3
- JsonConverter is called despite that CanConvert returns false, and despite that the target type isn't decorated with JsonConverterAttribute HOT 6
- ReferenceLoopHandling.Ignore unexpectedly skips objects - false positive if Equals/HashCode result is the same
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from newtonsoft.json.