Repeated serialization and deserialization creates duplicate items

后端 未结 2 1832
心在旅途
心在旅途 2020-11-30 10:58

Hi everyone i have a problem with my json serealization. I\'m using the Json.NET package under Unity: I\'m searching to make a Database, editable on my application and store

2条回答
  •  孤独总比滥情好
    2020-11-30 11:06

    Best way would be to configure JSON.Net to replace the default values by

    JsonSerializerSettings   jsSettings =  new JsonSerializerSettings
    {
      ObjectCreationHandling = ObjectCreationHandling.Replace,
    };
    
    JsonConvert.DeserializeObject(jsonString, jsSettings);
    

提交回复
热议问题