Sign in Join
FPDoc Onlineexperiment

TJSONComparer.Compare procedure

Member of TJSONComparerpublicIn unit JsonComparer

Compares two JSON data structures

Declaration

pascal
procedure Compare(aExpected: TJSONData; aActual: TJSONData)
class procedure Compare(aExpected: TJSONData; aActual: TJSONData; 
 aErrors: TStrings)

Arguments

aExpected

The expected JSON data structure

aActual

The actual JSON data structure to compare

aErrors

String list to collect comparison error messages

Description

Compares the aExpected and aActual JSON data structures recursively. Differences are reported to the error collection specified during construction. The method performs deep comparison of all JSON types including objects, arrays, and primitive values. For floating-point numbers, differences smaller than Epsilon are considered equal. Path information is included in error messages to identify the exact location of differences. A class method variant is also available that creates a temporary comparer instance.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.