Edit

Share via


JsonElement.DeepEquals(JsonElement, JsonElement) Method

Definition

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, and true only 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