Skip to content

DeepEquals Method ​

Definition ​

  • Namespace: JASE.Serializers
  • Assembly: JASE.Serializers.dll

Overloads ​

NameDescription
bool DeepEquals(string a, string b)Determines whether two JSON payloads are deeply equal.
bool DeepEquals(JsonDocument a, JsonDocument b)Determines whether two JsonDocument instances are structurally deeply equal.
bool DeepEquals(JsonElement a, JsonElement b)Performs a deep structural comparison of two JsonElement values.

bool DeepEquals(string a, string b) ​

csharp
bool DeepEquals(string a, string b)

Determines whether two JSON payloads are deeply equal.

Parameters ​

NameDescription
aThe first JSON payload string. May be null.
bThe second JSON payload string. May be null.

Returns ​

true if both payloads are null, or if both parse successfully and their root elements are deeply equal; otherwise false.

Remarks ​

Object property ordering is ignored (properties are compared by name), but array ordering is preserved.

This method parses both inputs into JsonDocument instances and disposes them before returning.

bool DeepEquals(JsonDocument a, JsonDocument b) ​

csharp
bool DeepEquals(JsonDocument a, JsonDocument b)

Determines whether two JsonDocument instances are structurally deeply equal.

Parameters ​

NameDescription
aThe first document. May be null.
bThe second document. May be null.

Returns ​

true if both are null, or if both are non-null and their root elements are deeply equal; otherwise false.

Remarks ​

Object property ordering is ignored (properties are compared by name), but array ordering is preserved.

bool DeepEquals(JsonElement a, JsonElement b) ​

csharp
bool DeepEquals(JsonElement a, JsonElement b)

Performs a deep structural comparison of two JsonElement values.

Parameters ​

NameDescription
aFirst element.
bSecond element.

Returns ​

true if a and b represent the same JSON structure and values; otherwise false.

Remarks ​

Comparison rules:

Object: properties are compared by name, ignoring declaration order.Array: elements are compared in order.Scalar values: compared by their JSON value representation.