Serialization 嵌套字典的自定义JsonConverter<&燃气轮机;Json.Net
我对字典的Json反序列化有问题。 我有以下数据结构:Serialization 嵌套字典的自定义JsonConverter<&燃气轮机;Json.Net,serialization,json.net,deserialization,Serialization,Json.net,Deserialization,我对字典的Json反序列化有问题。 我有以下数据结构: public class GameObject { public GameObject() { Components = new Dictionary<UInt64, List<EntityComponent>>(); } public Entity EntityTree { get; set; } public Dictionary<UInt64, List<Enti
public class GameObject
{
public GameObject()
{
Components = new Dictionary<UInt64, List<EntityComponent>>();
}
public Entity EntityTree { get; set; }
public Dictionary<UInt64, List<EntityComponent>> Components { get; set; }
}
公共类游戏对象
{
公共游戏对象()
{
组件=新字典();
}
公共实体EntityTree{get;set;}
公共字典组件{get;set;}
}
我尝试使用字符串作为键,但它返回异常,该异常表示它无法转换字典的值(它的疯狂)。
有没有人能帮我为这个结构编写正确的读写器,从而正确地反序列化我的字典?
我不明白如何正确地做这件事
请帮帮我 您试图反序列化的JSON是什么?我的JSON是这样的:“组件”:{“$id”:“5”,“$type”:“System.Collections.Generic.Dictionary
2[[System.UInt64,mscorlib],[System.Collections.Generic.List
1[[EntityComponentSystem.ECS.Components.EntityComponent,3DObjectsConverter]],mscorlib],[3]:{“$id”:“6”,“$type”:“ObjectsConverter.Components.RawGeometryComponent,3DObjectsConverter”,“索引”:[