From 813d33fc4d277c1b9fcd28fbdced18de4e567bcb Mon Sep 17 00:00:00 2001 From: bao-qian Date: Tue, 26 Apr 2016 00:54:09 +0100 Subject: [PATCH] Json: Overwriting instead of add to list http://stackoverflow.com/questions/29113063/json-net-why-does-it-add-to-list-instead-of-overwriting --- Wox.Infrastructure/Storage/JsonStorage.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Wox.Infrastructure/Storage/JsonStorage.cs b/Wox.Infrastructure/Storage/JsonStorage.cs index 367c502b01..398c8b1c61 100644 --- a/Wox.Infrastructure/Storage/JsonStorage.cs +++ b/Wox.Infrastructure/Storage/JsonStorage.cs @@ -26,7 +26,11 @@ namespace Wox.Infrastructure.Storage // use property initialization instead of DefaultValueAttribute // easier and flexible for default value of object - _serializerSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; + _serializerSettings = new JsonSerializerSettings + { + ObjectCreationHandling = ObjectCreationHandling.Replace, + NullValueHandling = NullValueHandling.Ignore + }; } public T Load()