Unit 'JsonComparer' Package
[Overview][Classes][Index] [#fcl]

TJSONComparer.Compare

Compares two JSON data structures

Declaration

Source position: jsoncomparer.pp line 46

public procedure TJSONComparer.Compare(

  aExpected: TJSONData;

  aActual: TJSONData

);

class procedure TJSONComparer.Compare(

  aExpected: TJSONData;

  aActual: TJSONData;

  aErrors: TStrings

);

Arguments

aExpected

  

The expected JSON data structure

aActual

  

The actual JSON data structure to compare

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

create

  

Creates a new JSON comparer instance

Epsilon

  

Floating-point comparison tolerance


Documentation generated on: Mar 10 2026