jsondiffpatch.net
jsondiffpatch.net copied to clipboard
ArrayDiff with ExcludePaths incorrectly fails
When comparing an object containing an array, using an exclude path for a property in that array incorrectly returns { "_t": "a" }
.
Example:
{
"User": {
"Adresses": [
{
"Id": "eb369327-2321-4ae2-bb2f-4d74dff1a70d",
"Street": "Streetname"
}
]
}
}
In this example, I want to compare this object. But I want to ignore the Id property. Using "User.Adresses[0].Id" in exclude paths, I can ignore this value.
But the result of the Diff is :
{
"User": {
"Adresses": {
"_t": "a"
}
}
}
I see the following in the source code in the beginning of the ArrayDiff method:
var result = JObject.Parse(@"{ ""_t"": ""a"" }");
Because there is no difference between the two values (ignoring the excluded paths), this result object is returned. In this case, when there is no difference, this method should return null instead.
Same issue relevant for me :D