Understand JSONassert strict mode
masterJSONassert provides two modes of comparison via the strictMode boolean parameter in assertEquals:
- Non-strict mode (
strictMode = false): This is the recommended setting for most tests. It compares the logical structure and data. It is less brittle because it ignores the order of elements in arrays or objects and allows the actual JSON to contain additional fields not present in the expected string. - Strict mode (
strictMode = true): This mode requires the actual JSON to match the expected JSON exactly in structure and content, typically requiring identical ordering and no extra fields.