O'Reilly logo

JavaScript JSON Cookbook by Ray Rischpater

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using JSONPath in your Java application

There's an implementation of JSONPath for Java, too, written by Jayway. It's available from GitHub, or you can obtain it through the Central Maven Repository if your project uses the Maven build system. It matches the original JSONPath API, returning Java objects and collections for fields in JSON objects.

Getting ready

You'll need to either download the code from GitHub at https://github.com/jayway/JsonPath, or, if you're using Maven as your build system, include the following dependency:

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

How to do it…

The Java implementation parses your JSON and exports a JsonPath class with a method ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required