JSONPath Library

In this lesson, we will learn to validate responses using JSONPath library.

What is JSONPath?

JSONPath is a query language that helps us in parsing the JSON data, which can be used for validation or assertions in a test.

JSONPath dependency

To use JSONPath, we have to include its dependency on our project.

Gradle

For a Gradle project, add the following dependency in build.gradle:

compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'

Maven

For a Maven project, add the following dependency in the pom.xml file:

<dependency>
    <groupId>com.jayway.jsonpath</groupId>
    <artifactId>json-path</artifactId>
    <version>2.4.0</version>
</dependency>

Get hands-on with 1400+ tech skills courses.