JSONPath Extractor avatar

JSONPath Extractor

Pricing

Pay per event

Go to Apify Store
JSONPath Extractor

JSONPath Extractor

Extract data from JSON using JSONPath expressions. Supports filters, wildcards, recursive descent, multi-expression batches, and flat or grouped output. Pure utility — no proxy, no scraping.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Stas Persiianenko

Stas Persiianenko

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

7 days ago

Last modified

Categories

Share

Run JSONPath expressions against any JSON document and extract matching values with their full paths. Supports complex queries, filter expressions, recursive descent (..), wildcards, multi-expression batches, and both flat and grouped output. Built on the battle-tested jsonpath-plus library.

🔗 Try it on Apify Store | 📖 JSONPath specification


What does JSONPath Extractor do?

JSONPath Extractor evaluates one or more JSONPath expressions against a JSON string and returns every matched value with its path and type. Feed it any valid JSON — objects, arrays, nested structures — and it produces a clean, structured dataset you can download as JSON, CSV, or Excel.

No browser, no proxy, no scraping. This is a pure utility — you provide the JSON, you provide the expressions, you get back the matched data. Runs in milliseconds, costs fractions of a cent.

Key capabilities:

  • 🔍 Wildcard selectors$.store.book[*].author matches all authors
  • 🔽 Recursive descent$..price finds all price fields at any depth
  • 🧮 Filter expressions$.book[?(@.price < 10)] selects books under $10
  • 📋 Array slicing$.items[0:3] extracts the first three items
  • 🔢 Multi-expression batches — evaluate dozens of expressions in one run
  • 📍 Path tracking — every result includes its full JSONPath location

Who is JSONPath Extractor for?

Backend developers and API integrators working with REST API responses, GraphQL payloads, or database exports. Use JSONPath to quickly extract the exact fields you need without writing a custom parser. Replace manual response.data.items[0].id chains with a declarative expression.

Data engineers and ETL pipeline builders transforming large JSON datasets. Run multiple expressions in a single pass — extract IDs, timestamps, nested arrays, and flags all at once. The flat output mode writes one dataset row per matched value, ready for downstream joins.

QA engineers and test automation specialists validating API contracts. JSONPath Extractor lets you describe what you expect from an API response in a human-readable expression and extract values to assert against — no extra parsing code needed.

Analytics teams and data analysts receiving JSON exports from SaaS tools (Stripe, Salesforce, HubSpot, etc.). Instead of writing Python or JavaScript to navigate the structure, paste the export and describe what you want.

No-code automation builders using Zapier, Make, or n8n who need to pull a specific nested field out of a JSON payload for use in downstream steps. Run this actor via the API or as a webhook handler.

Why use JSONPath Extractor?

  • Zero setup — no credentials, no login, no proxy needed
  • Handles any JSON shape — arrays as root, deeply nested objects, mixed types
  • Full JSONPath-Plus feature set — filters, scripts, recursive descent, custom functions
  • Path tracking — see exactly where in the document each result came from
  • Batch queries — run 20 expressions against the same JSON in a single actor run
  • Export-ready — download results as JSON, CSV, or Excel from the Apify dataset
  • API-accessible — integrate into pipelines via the Apify API, webhooks, or MCP
  • Deterministic — pure computation, no network requests, always reproducible results
  • Fast — typical run completes in under 2 seconds

What data can you extract?

JSONPath Extractor returns structured rows for every match:

FieldTypeDescription
expressionstringThe JSONPath expression that produced this match
resultPathstringFull JSONPath location of the matched value (e.g. $['store']['book'][0]['price'])
matchIndexnumberZero-based index of this match within the expression's result set
matchCountnumberTotal number of matches for this expression
valueanyThe matched value — string, number, boolean, null, or JSON string for objects/arrays
valueTypestringJavaScript typeof: string, number, boolean, object, null

When a matched value is an object, its top-level fields are also spread into the row for easier table viewing.

How much does it cost to run JSONPath queries?

This actor uses pay-per-event pricing — you pay only per JSONPath expression evaluated. No monthly subscription. All platform costs are included.

FreeStarter ($29/mo)Scale ($199/mo)Business ($999/mo)
Per query$0.00115$0.001$0.00078$0.0006
Start event$0.005$0.005$0.005$0.005
10 expressions~$0.017~$0.015~$0.013~$0.011

Higher-tier plans (PLATINUM, DIAMOND) get deeper volume discounts.

Real-world cost examples:

Use caseExpressionsDurationCost (Free tier)
Extract 3 fields from API response3~1s~$0.008
Batch transform (20 expressions)20~2s~$0.028
Daily ETL pipeline (100 expressions/day)100~5s~$0.12/day

With $5 of free Apify credits, you can run roughly 300 expressions on the free tier.

How to run JSONPath expressions against your JSON

  1. Go to JSONPath Extractor on Apify Store
  2. Click Try for free
  3. In the JSON input field, paste your JSON string
  4. In the JSONPath expressions field, add your expressions (one per line)
  5. Configure options: path tracking, flatten vs grouped output
  6. Click Start and wait (typically under 5 seconds)
  7. View results in the Dataset tab, or download as JSON/CSV/Excel

Input examples:

Query all authors from a bookstore API response:

{
"jsonInput": "{\"store\":{\"book\":[{\"author\":\"Nigel Rees\",\"price\":8.95},{\"author\":\"Herman Melville\",\"price\":8.99}]}}",
"expressions": ["$.store.book[*].author"],
"includeResultPath": true,
"flattenResults": true
}

Filter objects matching a condition:

{
"jsonInput": "[{\"name\":\"Alice\",\"score\":95},{\"name\":\"Bob\",\"score\":72},{\"name\":\"Carol\",\"score\":88}]",
"expressions": ["$[?(@.score >= 85)].name"],
"includeResultPath": true,
"flattenResults": true
}

Batch extraction (multiple fields in one run):

{
"jsonInput": "{\"order\":{\"id\":\"ORD-123\",\"customer\":{\"email\":\"user@example.com\"},\"items\":[{\"sku\":\"A1\",\"qty\":2}]}}",
"expressions": ["$.order.id", "$.order.customer.email", "$.order.items[*].sku"],
"includeResultPath": true,
"flattenResults": true
}

Input parameters

ParameterTypeDefaultDescription
jsonInputstringrequiredThe JSON string to query. Must be valid JSON.
expressionsstring[]requiredOne or more JSONPath expressions to evaluate. Each is run independently.
includeResultPathbooleantrueInclude the full JSONPath location of each matched value in the output.
flattenResultsbooleantrueWhen true, each matched value is a separate dataset row. When false, all matches per expression are grouped into one row.
wrapSingleValuebooleantrueKept for schema compatibility. Primitive values are output directly in the value field.

Output examples

Flat mode (flattenResults: true) — each match is its own row:

[
{
"expression": "$.store.book[*].author",
"matchIndex": 0,
"matchCount": 3,
"valueType": "string",
"resultPath": "$['store']['book'][0]['author']",
"value": "Nigel Rees"
},
{
"expression": "$.store.book[*].author",
"matchIndex": 1,
"matchCount": 3,
"valueType": "string",
"resultPath": "$['store']['book'][1]['author']",
"value": "Evelyn Waugh"
}
]

Grouped mode (flattenResults: false) — all matches per expression in one row:

[
{
"expression": "$.store.book[*].author",
"matchCount": 3,
"values": ["Nigel Rees", "Evelyn Waugh", "Herman Melville"],
"valueTypes": ["string", "string", "string"],
"paths": ["$['store']['book'][0]['author']", "$['store']['book'][1]['author']", "$['store']['book'][2]['author']"]
}
]

Object match (flattened into row columns):

{
"expression": "$.store.book[?(@.price < 10)]",
"matchIndex": 0,
"matchCount": 2,
"valueType": "object",
"resultPath": "$['store']['book'][0]",
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95,
"value": "{\"category\":\"reference\",\"author\":\"Nigel Rees\",...}"
}

JSONPath syntax reference

ExpressionDescriptionExample
$Root element$ returns the entire document
.keyChild accessor$.store.name
['key']Bracket notation$['store']['name']
[*]Wildcard — all elements$.items[*]
..keyRecursive descent$..price finds all price fields
[n]Array index$.items[0]
[start:end]Array slice$.items[0:3]
[?(expr)]Filter expression$.items[?(@.active==true)]
@Current node in filter$[?(@.price < 10)]
,Union$['price','author']
lengthArray length$.items.length

Comparison operators in filters: ==, !=, <, <=, >, >=

Logical operators: && (AND), || (OR)

Tips for best results

  • 🧪 Test expressions incrementally — start with $..key to find all matching keys, then narrow to $.path.to.key
  • 📦 Group related queries — run all the expressions you need in one actor call instead of separate runs
  • 🔧 Use flattenResults: false when you want to process all matches as an array in a single downstream step
  • 📍 Enable includeResultPath when debugging — the path column tells you exactly where each value lives in the document
  • 🔁 Combine with webhooks — trigger this actor automatically when your API returns a payload and you need a specific field
  • For API integrations, use the Apify API with waitForFinish=60 to get results synchronously in one request
  • 🧮 Non-matching expressions produce a row with matchCount: 0 — useful for asserting that a field does NOT exist

Integrations

JSONPath Extractor → Google Sheets — extract fields from daily API exports and append them to a tracking spreadsheet. Use Apify's Google Sheets integration or pipe the JSON dataset output via Make.

JSONPath Extractor → Slack — validate an API contract after deployment. Trigger via webhook, extract the expected field, and post a Slack alert if matchCount is 0 (missing field).

JSONPath Extractor → Make / Zapier — after receiving a JSON webhook payload, run JSONPath Extractor to pull nested fields before passing them to downstream actions. Eliminates the need for JavaScript modules in your automation.

JSONPath Extractor → n8n — use as an HTTP node to evaluate JSONPath in your n8n workflow. Connect to any dataset output for structured table results.

Scheduled extraction pipeline — combine with a scraper that produces JSON datasets, then run JSONPath Extractor on a schedule to extract specific fields from daily dumps.

CI/CD API contract testing — call JSONPath Extractor from your CI pipeline via cURL to assert that your API response contains the expected fields and values before merging.

Using the Apify API

Run JSONPath Extractor programmatically from any language.

Node.js

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('automation-lab/jsonpath-extractor').call({
jsonInput: '{"users":[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]}',
expressions: ['$[*].id', '$[*].name'],
includeResultPath: true,
flattenResults: true,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

Python

from apify_client import ApifyClient
client = ApifyClient('YOUR_APIFY_TOKEN')
run = client.actor('automation-lab/jsonpath-extractor').call(run_input={
'jsonInput': '{"users":[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]}',
'expressions': ['$[*].id', '$[*].name'],
'includeResultPath': True,
'flattenResults': True,
})
items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)

cURL

curl -X POST "https://api.apify.com/v2/acts/automation-lab~jsonpath-extractor/runs?token=YOUR_APIFY_TOKEN&waitForFinish=60" \
-H "Content-Type: application/json" \
-d '{
"jsonInput": "{\"users\":[{\"id\":1,\"name\":\"Alice\"},{\"id\":2,\"name\":\"Bob\"}]}",
"expressions": ["$[*].id", "$[*].name"],
"includeResultPath": true,
"flattenResults": true
}'

Response includes defaultDatasetId — fetch results at:

GET https://api.apify.com/v2/datasets/{defaultDatasetId}/items?token=YOUR_APIFY_TOKEN

Use with AI agents via MCP

JSONPath Extractor is available as a tool for AI assistants that support the Model Context Protocol (MCP).

Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:

Setup for Claude Code

$claude mcp add --transport http apify "https://mcp.apify.com?tools=automation-lab/jsonpath-extractor"

Setup for Claude Desktop, Cursor, or VS Code

Add this to your MCP config file:

{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com?tools=automation-lab/jsonpath-extractor"
}
}
}

Your AI assistant will use OAuth to authenticate with your Apify account on first use.

Example prompts

Once connected, try asking your AI assistant:

  • "Use automation-lab/jsonpath-extractor to extract all email addresses from this JSON: [paste JSON]"
  • "Run the expression $..price against my product catalog JSON and show me a table of all prices with their paths"
  • "Filter this API response with JSONPath to find all active users where status equals 'active'"

Learn more in the Apify MCP documentation.

Yes. JSONPath Extractor processes data you provide — it does not scrape any website, make any outbound HTTP requests, or access any third-party service. You supply the JSON, the actor runs JSONPath computations locally, and returns the results.

This tool is a pure computational utility. It is equivalent to running jsonpath-plus in your own Node.js environment. No terms of service, robots.txt, or rate limits apply.

As with all data processing, ensure you have the right to process any personally identifiable information (PII) included in your JSON input in accordance with GDPR, CCPA, or applicable privacy regulations.

FAQ

Can JSONPath Extractor handle large JSON documents? Yes. The actor runs in a 128–256 MB container and can process multi-megabyte JSON documents without issue. For very large documents (10+ MB), consider splitting them into chunks or increasing the memory setting.

How much does it cost to run 1,000 queries per day? At the BRONZE ($29/mo Starter plan) rate of $0.001 per query plus $0.005 per run start, 1,000 queries across 10 runs costs approximately $1.05/day. At the free tier rate it's approximately $1.20/day against your $5 monthly credit.

What is the difference between JSONPath and JMESPath or XPath? JSONPath ($..book[*]) is the de facto standard for querying JSON, modeled after XPath for XML. JMESPath is an alternative standard used in AWS CLI. XPath is for XML only. JSONPath-Plus (used here) extends the original Goessner spec with additional functions like length, keys, and extended filter support.

Why do some expressions return 0 matches? The most common causes: (1) the path uses dot notation for a key that contains special characters — use bracket notation instead ($['my-key']); (2) array indexing is off by one — JSONPath arrays are 0-indexed; (3) filter comparison uses = instead of == — use == for equality. Check the resultPath column on a successful match to understand the actual path structure.

Can I use recursive descent to search all levels? Yes. $..key finds all occurrences of key at any depth. For example, $..price returns every price field in the entire document regardless of nesting level.

Why is my filter expression not working? Ensure you're using @ to reference the current node: $[?(@.age > 18)]. String comparisons require quotes: $[?(@.status == "active")]. The == operator is required (not =).

Can I extract nested objects, not just primitives? Yes. If a JSONPath expression matches an object or array, the entire object is returned. In flat mode, top-level fields of the matched object are spread into the row columns for easy table display.

Other JSON and data tools

Looking for related JSON utilities or data extraction tools? Check out these other actors from the same publisher: