Skip to main content

Working with JSON

JSONPath is the query language used across Replay for extracting values from responses and targeting assertion paths.

JSONPath Basics

JSONPath expressions navigate JSON structures:

Shorthand Syntax

Replay accepts several shorthand forms:

Common Patterns

Nested Fields

Array Access

Array Wildcards

Array Slices

In HTTP Steps

The HTTP response is structured as:
Target each part:

In Database Steps

PostgreSQL results are arrays of row objects:

In Shell Steps

Shell stdout is parsed as JSON if possible:
If the output is not valid JSON, use $ to grab the raw string:

Assertions with JSONPath

Debugging JSONPath

Enable debug mode to see the full response structure:
This prints the request and response to the terminal, making it easy to find the right path.

What’s Next?