This project has moved and is read-only. For the latest updates, please go here.

JsonConvert.DeserializeObject method duplicates items

Oct 28, 2009 at 2:04 PM

Hi all,

I think there is a bug on deserialization on Json.Net. I changed the "PersonTypedObjectDeserialization" test procedure on "Newtonsoft.Json.Tests.Serialization.JsonSerializerTest" class. On test case store.product count is 2 but after deserialization deserializedStore.product.Count is 4.

I also wrote this issue on "Issue Tracker".


public void PersonTypedObjectDeserialization()
Store store = new Store();
string jsonText = JsonConvert.SerializeObject(store);

Store deserializedStore = (Store)JsonConvert.DeserializeObject(jsonText, typeof(Store));

Assert.AreEqual(store.Establised, deserializedStore.Establised);

Assert.AreEqual(store.product.Count, deserializedStore.product.Count); //<---- i am adding this line..




Nov 2, 2009 at 8:26 AM

See my comment on the now closed issue.