Mastering JSONPath for API Testing on iPhone, iPad, and Mac

API responses can easily grow into thousands of lines of JSON. Searching manually wastes time and often leads to missed details.

This is where JSONPath comes in — a query language that lets you instantly filter, search, and extract exactly the data you need.

In this article, we’ll cover JSONPath basics, advanced use cases, and how to use it directly inside API Orbit — a native API client for iPhone, iPad, Mac, and Vision Pro.

Large unfiltered JSON response displayed in API Orbit
Without filters, even simple API responses can feel overwhelming.

What is JSONPath?

JSONPath is to JSON what XPath is to XML. It works like a search engine for JSON responses. With JSONPath you can:

Access a property by name:
JavaScript
$.user.name
Select an array element:
JavaScript
$.items[0]
Filter by conditions:
JavaScript
$.books[?(@.price < 10)]
Search recursively through nested objects:
JavaScript
$..author

Example JSON Response

Here’s a sample API response with user data:

JSON
{
  "data": [
    {
      "id": 1,
      "email": "george.bluth@reqres.in",
      "first_name": "George",
      "last_name": "Bluth",
      "avatar": "https://reqres.in/img/faces/1-image.jpg"
    },
    {
      "id": 2,
      "email": "janet.weaver@reqres.in",
      "first_name": "Janet",
      "last_name": "Weaver",
      "avatar": "https://reqres.in/img/faces/2-image.jpg"
    },
    {
      "id": 3,
      "email": "emma.wong@reqres.in",
      "first_name": "Emma",
      "last_name": "Wong",
      "avatar": "https://reqres.in/img/faces/3-image.jpg"
    }
  ],
  "page": 1,
  "per_page": 6,
  "total": 12,
  "total_pages": 2
}

Basic JSONPath Queries

📧 Get all emails:

JavaScript
$.data[*].email

Output:

JSON
[
  "george.bluth@reqres.in",
  "janet.weaver@reqres.in",
  "emma.wong@reqres.in"
]

🆔 Get all IDs:

JavaScript
$.data[*].id

Output:

JSON
[1, 2, 3]

🖼️ Extract all avatars:

JavaScript
$.data[*].avatar

Output:

JSON
[
  "https://reqres.in/img/faces/1-image.jpg",
  "https://reqres.in/img/faces/2-image.jpg",
  "https://reqres.in/img/faces/3-image.jpg"
]

👨 Find user by name:

JavaScript
$.data[?(@.first_name == "George")]

Output:

JSON
[
  {
    "id": 1,
    "email": "george.bluth@reqres.in",
    "first_name": "George",
    "last_name": "Bluth",
    "avatar": "https://reqres.in/img/faces/1-image.jpg"
  }
]
JSONPath query extracting emails from user list in API Orbit
JSONPath instantly extracts only the fields you need.

Using JSONPath Inside API Orbit

In API Orbit, JSONPath is built right into the response viewer. You don’t need to copy JSON into a separate tool — just run your request, open the Filter option, and start typing.

On Mac, the filter opens in a separate window.
On iPhone, iPad, and Vision Pro, it appears as a sheet.
On Mac, you can also use the shortcut ⌘ + ⇧ + F.

As you type, the JSON response updates live in a read-only editor, showing exactly the data you’re looking for.

JSONPath filter applied in API Orbit on Mac

On Mac, the filter opens in a separate window with live results.

Advanced Filters

API Orbit supports advanced JSONPath features:

Users with a specific last name:
JavaScript
$.data[?(@.last_name == "Weaver")]

Returns all users whose last_name equals “Weaver”.

Users with IDs greater than 1:
JavaScript
$.data[?(@.id > 1)]

Keeps only records where id > 1.

All first names recursively:
JavaScript
$..first_name

Collects every first_name value anywhere in the document (recursive descent).

Combine conditions:
JavaScript
$.data[?(@.id > 1 && @.last_name == "Wong")]

Returns users where both conditions are true: id > 1 and last_name == “Wong”.

Even Yoda would agree: mastering APIs takes practice.

Funny Yoda meme about API testing
When JSONPath fails, trust the force of API testing.

Practical Use Cases

Quickly filter user data from long API responses.
Validate IDs or emails across datasets.
Extract avatar URLs for testing media endpoints.
Debug nested structures in real-world APIs.List item

Conclusion

JSONPath transforms messy, deeply nested JSON into clear, actionable insights. Instead of scrolling endlessly through raw API responses, you can instantly filter, search, and extract just the data you need.

With API Orbit, JSONPath becomes even more powerful — seamlessly integrated into your API workflow on iPhone, iPad, Mac, and Vision Pro. You don’t just send requests, you gain clarity and speed across all Apple devices.

👉 Try API Orbit today and explore JSONPath with real API responses!

Leave a Comment

Scroll to Top