WebTestClient supports passing a target Class in JsonPathAssertions. We should add an overloaded method that accepts ParameterizedTypeReference. Also, even with the current method, it is only possible to decode to basic types without customizing the JSONPath Configuration.

Once it is possible to customize the JSONPath Configuration in JsonPathExpectationsHelper with #31651, we can update WebTestClient to prepare a Configuration with the JsonProvider that aligns with that configured JSON encoding and decoding, and/or allow having the Configuration passed in somehow through the WebTestClient.Builder (without bring in a hard dependency).

Comment From: snicoll

I believe that .jsonPath(String expression, Object...args) should be deprecated as part of this effort if we want to provide the Configuration in the jsonPath call. Or perhaps it should be deprecated anyway, see https://github.com/spring-projects/spring-framework/issues/32036 for more details.