liveBook · Manning

JSONPath

JSONPath is a query language for selecting and extracting values from JSON data.

How 3 Manning books explain it

BDD in Action, Second Edition

A JSONPath expression is a query expression for selecting or evaluating values within JSON data.

How it is used
Supports API acceptance tests by selecting expected values from REST responses without exercising the user interface.
How deep it goes
Demonstrates scalar, nested, typed, object, and collection extraction but does not develop JSONPath grammar or implementation internals.
Examples
Uses frequent-flyer registration, passport lookup, and flight-history extraction as concrete query examples.
What you can do after
Apply it via Rest Assured to extract scalar values, nested objects, or collections from API responses.

Read how BDD in Action, Second Edition explains JSONPath →

Automating API Delivery

A JSONPath expression is a query expression that selects or navigates elements in a JSON document.

How it is used
Locates OpenAPI definition elements for Spectral rules that automate API style-guide checks.
How deep it goes
Defines root and child navigation, then works through rule targets and JSONPath Plus path-name selection without developing a full query-language reference.
Examples
Uses `$.info`, `$.paths[*]~`, and `$.paths[*].get.operationId` to target descriptions, URI paths, and GET operation IDs.
What you can do after
Apply it via Spectral to target linting checks, and test JSONPath Plus selections with `jpp` before running a rule.

Read how Automating API Delivery explains JSONPath →

The Design of Web APIs, Second Edition

JSONPath is a query language and expression syntax for selecting and extracting values from JSON-like hierarchical data.

How it is used
Targets OpenAPI elements in a Spectral rule's `given` before `then` checks their values.
How deep it goes
Works through root selection, wildcards, recursive search, key alternatives, filters, and selector testing; defers implementation-specific details to JSONPath Plus documentation.
Examples
Uses API versions, query-parameter names, POST and PUT responses, and query or path parameters as selection targets.
What you can do after
Apply it via Spectral to target lint checks and verify selected locations with a temporary `undefined` check.

Read how The Design of Web APIs, Second Edition explains JSONPath →

Also covered in

What to know first

Related concepts

Questions about JSONPath

What is JSONPath?

JSONPath is a query language for selecting and extracting values from JSON data.

Which Manning books explain JSONPath?

BDD in Action, Second Edition, Automating API Delivery and The Design of Web APIs, Second Edition.

What should I know before learning JSONPath?

Manning books that teach JSONPath usually introduce OpenAPI specification first.

What is the difference between JSONPath and XPath?

JSONPath is a query language for selecting and extracting values from JSON data. XPath is a language for navigating and selecting nodes in structured documents, especially XML documents.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.