org.springframework.test.web.servlet.result

## Class JsonPathResultMatchers

- java.lang.Object
- - org.springframework.test.web.servlet.result.JsonPathResultMatchers

    public class JsonPathResultMatchers
    extends Object

Factory for assertions on the response content using JSONPath expressions. An instance of this class is typically accessed via `MockMvcResultMatchers.jsonPath(java.lang.String, java.lang.Object...)`.

Since:
  3.2
Author:
  Rossen Stoyanchev

### Constructor Summary

Constructors
`protected` `JsonPathResultMatchers(String expression, Object... args)` Protected constructor.

### Method Summary

Methods
`ResultMatcher` `doesNotExist()` Evaluate the JSON path and assert not content was found.
`ResultMatcher` `exists()` Evaluate the JSONPath and assert that content exists.
`ResultMatcher` `isArray()` Evluate the JSON path and assert the content found is an array.
`<T> ResultMatcher` `value(org.hamcrest.Matcher<T> matcher)` Evaluate the JSONPath and assert the value of the content found with the given Hamcrest `Matcher`.
`ResultMatcher` `value(Object expectedValue)` Evaluate the JSONPath and assert the value of the content found.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### JsonPathResultMatchers

    protected JsonPathResultMatchers(String expression,
                          Object... args)

Protected constructor. Use `MockMvcResultMatchers.jsonPath(String, Object...)` or `MockMvcResultMatchers.jsonPath(String, Matcher)`.

### Method Detail

#### value

    public <T> ResultMatcher value(org.hamcrest.Matcher<T> matcher)

Evaluate the JSONPath and assert the value of the content found with the given Hamcrest `Matcher`.

#### value

    public ResultMatcher value(Object expectedValue)

Evaluate the JSONPath and assert the value of the content found.

#### exists

    public ResultMatcher exists()

Evaluate the JSONPath and assert that content exists.

#### doesNotExist

    public ResultMatcher doesNotExist()

Evaluate the JSON path and assert not content was found.

#### isArray

    public ResultMatcher isArray()

Evluate the JSON path and assert the content found is an array.