JsonContent.AreEqualByContent

JsonContent.AreEqualByContent method

Compares two JsonContent objects for equality.

public static bool AreEqualByContent(JsonContent a, JsonContent b, float precission)
ParameterTypeDescription
aJsonContentThe first object to compare.
bJsonContentThe second object to compare.
precissionSingleThe precission threshold when comparing floating point values.

Return Value

true if the objects are considered equal

Remarks

  • Comparing json structures is tricky because the values are typeless, so when we parse a json DOM into memory we don’t know which should be the right type to use for comparison. - Also, System.Text.JSon is roundtrip safe when used in Net Core, but it is not when used in Net Framework, so depending on the framework we use, floating point roundtrips will behave differently.

See Also