Package org.springframework.test.json

# Interface JsonComparator

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface JsonComparator
Strategy interface used to compare JSON strings.

Since:
  6.2
Author:
  Phillip Webb
See Also:
  - `JsonAssert`

## Method Summary

Modifier and Type
Method
Description
`default void`
`assertIsMatch(String expectedJson, String actualJson)`
Assert that the `expectedJson` matches the comparison rules of ths instance against the `actualJson`.
`JsonComparison`
`compare(String expectedJson, String actualJson)`
Compare the given JSON strings.

## Method Details

### compare

JsonComparison compare(@Nullable String expectedJson, @Nullable String actualJson)
Compare the given JSON strings.

Parameters:
  `expectedJson` - the expected JSON
  `actualJson` - the actual JSON
Returns:
  the JSON comparison

### assertIsMatch

default void assertIsMatch(@Nullable String expectedJson, @Nullable String actualJson)
Assert that the `expectedJson` matches the comparison rules of ths instance against the `actualJson`. Throw an `AssertionError` if the comparison does not match.

Parameters:
  `expectedJson` - the expected JSON
  `actualJson` - the actual JSON