talira

Jayway JsonPath

Query and update JSON documents in Java with XPath-like JsonPath expressions

open sourceApache-2.0free

Jayway JsonPath is a Java library for reading JSON documents with JsonPath expressions, a port of Stefan Goessner's JsonPath. Expressions use dot or bracket notation from the root $, with wildcards, deep scan, array slices, functions and filter predicates written inline, through its Filter API or as your own code. It can return paths instead of values, set values, and map results to typed objects through pluggable JSON and mapping providers for Jackson, Jackson 3, Gson and Jakarta JSON.

Problems it solves

  • query nested JSON in Java with an XPath-like expression
  • filter array elements in a JSON response in a Java test
  • pull values out of JSON in Java without mapping it to classes

Features

  • dot and bracket notation paths with wildcards, deep scan and slices
  • inline, Filter API and custom predicates
  • path functions such as length, min, max and avg
  • returns paths instead of values, and sets values
  • pluggable providers for Jackson, Jackson 3, Gson and Jakarta JSON

Limitations

  • Version 3.0.0 needs Java 17 or newer1

Alternatives

The same job

These do what Jayway JsonPath does.

  1. Gson Google's Java library for converting objects to and from JSON

Compare Jayway JsonPath with the top 3