Closed weichch closed 2 years ago
There is also unnecessary allocation incurred by boxing/unboxing in current comparer, might need to look for a fix. So bumping up version number to 1.1.0
.
var value = JsonValue.Create(1);
value.TryGetValue<object>(out var obj) // unnecessary boxing
DeepEquals method currently only implements syntactic equality that compares the raw text of two
JsonNode
if both backed byJsonElement
.For example, the below test will fail:
but, can pass for
This is not the case for only one
JsonNode
backed byJsonElement
as the method is already trying to deserialize the JSON representation into .NET types and do semantic comparison.The following test can pass:
There should be option/argument to allow using syntactic and semantic
IEqualityComparer<JsonElement>
implementations when calling the method.Also see some discussions here.
This may also block adding
JsonDocument
support.