Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
JsonElement.DeepEquals(JsonElement, JsonElement) Method
Definition
- Namespace:
- System.Text.Json
- Assembly:
- System.Text.Json.dll
- Package:
- System.Text.Json v11.0.0-preview.5.26302.115
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Compares the values of two JsonElement values for equality, including the values of all descendant elements.
public:
static bool DeepEquals(System::Text::Json::JsonElement element1, System::Text::Json::JsonElement element2);
public static bool DeepEquals(System.Text.Json.JsonElement element1, System.Text.Json.JsonElement element2);
static member DeepEquals : System.Text.Json.JsonElement * System.Text.Json.JsonElement -> bool
Public Shared Function DeepEquals (element1 As JsonElement, element2 As JsonElement) As Boolean
Parameters
- element1
- JsonElement
The first JsonElement to compare.
- element2
- JsonElement
The second JsonElement to compare.
Returns
true if the two values are equal; otherwise, false.
Remarks
Deep equality of two JSON values is defined as follows:
- JSON values of different kinds are not equal.
- JSON constants
null,false, andtrueonly equal themselves. - JSON numbers are equal if and only if they have they have equivalent decimal representations, with no rounding being used.
- JSON strings are equal if and only if they are equal using ordinal string comparison.
- JSON arrays are equal if and only if they are of equal length and each of their elements are pairwise equal.
- JSON objects are equal if and only if they have the same number of properties and each property in the first object has a corresponding property in the second object with the same name and equal value. The order of properties is not significant, with the exception of repeated properties that must be specified in the same order (with interleaving allowed).
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
Was this page helpful?
