Ttooleras
🎯

JSON Path Evaluator

Developer Utilities

Query JSON with JSONPath — test expressions like $.users[0].name, filter, extract. Free, private — all processing in your browser.

Advertisement

The JSONPath Evaluator tests JSONPath expressions against JSON documents — the de facto query language for JSON, inspired by XPath for XML. JSONPath uses expressions like $.users[?(@.age > 18)].name to filter, extract, and navigate JSON without writing procedural code. Paste your JSON and a JSONPath expression, see matched values instantly. Essential for: extracting specific fields from large API responses, filtering arrays based on conditions, querying configuration files, and building dynamic data pipelines that need to pull specific values from JSON.

JSONPath is standardized in RFC 9535 (2024) but has multiple implementations (Jayway, Goessner, Stefan Goessner's original) with minor differences. This evaluator uses the RFC 9535 standard syntax with Jayway-compatible extensions — matching what most modern libraries implement. Supports all standard operators: $ (root), . (child), .. (recursive descent), * (wildcard), [n] (index), [n,m] (union), [start:end] (slice), [?(expression)] (filter), @ (current node), and modern function syntax.

JSON Path Evaluator — key features

RFC 9535 compliant

Official 2024 IETF standard JSONPath syntax.

All operators supported

$, ., .., *, [n], [start:end:step], [?(filter)], @, union, recursive descent.

Filter expressions

Compare, logical ops, regex match. Full expression evaluation in filters.

Functions

length, count, match, search, value — standard functions for filter expressions.

Real-time evaluation

Results update as you edit the JSONPath expression.

Multiple match display

All matched values shown. Count of matches displayed.

Syntax highlighting

JSONPath expression and JSON both syntax-highlighted.

100% client-side

Your JSON and queries stay in browser.

How to use the JSON Path Evaluator

  1. 1

    Paste JSON

    The data you want to query — API response, config, any valid JSON.

  2. 2

    Enter JSONPath expression

    Start with $ for root. Use . for properties, [] for array access, [?(...)] for filters.

  3. 3

    See results

    Matched values appear. Count shown. If no matches, check expression syntax.

  4. 4

    Iterate

    Refine expression, see results update live. Build complex queries incrementally.

  5. 5

    Copy expression

    Once it works, copy the JSONPath expression to use in your code (Python jsonpath-ng, Node jsonpath, Java Jayway).

Common use cases for the JSON Path Evaluator

API data extraction

  • Pull specific fields from responses: API returns complex object. Extract just user emails: $.users[*].email
  • Filter based on conditions: Active admins: $.users[?(@.active && @.role == admin)]
  • Paginate client-side: First 10 results: $.results[0:10]
  • Extract deeply nested values: Navigate complex GraphQL/REST responses without writing boilerplate code.

Automation and scripting

  • CI/CD scripts: Extract values from JSON config or API calls in CI. Pass to next step.
  • Shell scripts: jq (similar concept) is standard CLI tool. JSONPath for libraries.
  • Ansible/Puppet: Configuration management tools accept JSONPath-like queries.
  • ETL pipelines: Extract specific fields from JSON sources in data pipelines.

Testing

  • API response assertions: Assert specific fields in response. $.user.email should equal expected.
  • GraphQL response checking: Complex response, check specific paths.
  • Test fixtures: Extract expected values from JSON fixtures for comparisons.

Exploration and debugging

  • Find all occurrences: $..name finds every name in a document — useful for auditing.
  • Locate specific value: Search for specific IDs, values. Where does userId 42 appear?
  • Count items matching condition: count($.users[?(@.premium)]) — how many premium users?

JSON Path Evaluator — examples

Root

Entire document.

Input
Expression: $
Output
Returns the entire JSON document.

Property access

Navigate object.

Input
$.user.profile.email
Output
Returns the email value at user.profile.email path.

Array index

Specific element.

Input
$.users[0]
Output
First user object.
$.users[-1] = last user.

All items

Wildcard.

Input
$.users[*].name
Output
Returns array of all names in users array.

Filter

Conditional selection.

Input
$.products[?(@.price < 100 && @.inStock == true)]
Output
Returns products under $100 that are in stock.

Recursive descent

All matching paths.

Input
$..email
Output
Returns every email anywhere in document — whether at $.user.email, $.contacts[0].email, $.admin.backup.email, etc.

Array slice

Range of items.

Input
$.items[0:5]
Output
First 5 items (indices 0-4).
$.items[-3:] = last 3 items.

Regex filter

Match by pattern.

Input
$.users[?(@.email =~ /@company\.com$/)]
Output
Users with company.com emails.

Combined operations

Filter + extract.

Input
$.users[?(@.age >= 18)].email
Output
Emails of adult users — filter by age, then extract email.

Technical details

JSONPath syntax (RFC 9535):

Basic operators:

- $ — root node.
- .property — child by name.
- [property] — child (supports special chars in names).
- ..property — recursive descent (all descendants with this name).
- * — wildcard (all children).
- [n] — array index (0-based).
- [-1] — from end of array.
- [n,m,k] — union (multiple specific indices).
- [start:end:step] — slice (like Python).
- [?(expression)] — filter based on condition.
- @ — current node in filter.

Example JSON:

``json
{
"users": [
{"name": "Alice", "age": 30, "role": "admin"},
{"name": "Bob", "age": 25, "role": "user"},
{"name": "Carol", "age": 35, "role": "admin"}
],
"config": {
"version": "1.0"
}
}
``

Example queries:

| Expression | Meaning | Result |
|---|---|---|
| $ | Root | entire object |
| $.users | Users array | [Alice, Bob, Carol] |
| $.users[0] | First user | {name: Alice, ...} |
| $.users[-1] | Last user | {name: Carol, ...} |
| $.users[*].name | All names | [Alice, Bob, Carol] |
| $.users[0,2] | Users 0 and 2 | [Alice, Carol] |
| $.users[0:2] | First two users | [Alice, Bob] |
| $.users[?(@.age > 28)] | Users over 28 | [Alice, Carol] |
| $.users[?(@.role == "admin")].name | Admin names | [Alice, Carol] |
| $..name | All names anywhere | [Alice, Bob, Carol] |
| $..role | All roles | [admin, user, admin] |
| $.users[?(@.name =~ "^A")] | Names starting with A | [Alice] |

Filter expressions:

Within [?(...)]:

- Comparison: ==, !=, <, >, <=, >=
- Logical: &&, ||, !
- Regex: =~ (match against regex)
- Exists check: @.email (truthy if field exists)

Examples:

``
$.products[?(@.price < 100 && @.stock > 0)]
$.users[?(@.age >= 18 || @.verified == true)]
$.items[?(@.tags && @.tags.length > 0)]
``

Recursive descent (..):

$..name finds all name properties at any depth. Powerful but can return many results.

Functions (RFC 9535 standard):

- length(array) — array length
- count(nodes) — count of matched nodes
- match(string, regex) — regex match
- search(string, regex) — substring match via regex
- value(node) — value of single node (for type conversion in filters)

Example: $.users[?(length(@.tags) > 3)] (users with more than 3 tags).

Differences between JSONPath implementations:

Historical JSONPath had no single spec — Goessner's 2007 blog post was de facto standard. Multiple implementations:

- Jayway (Java): widely used. Adds some Jayway-specific features.
- jsonpath (JavaScript): Node.js implementation.
- jq: actually a different query language, more powerful.
- RFC 9535 (2024): official IETF spec.

This evaluator uses RFC 9535 + widely-compatible extensions.

Comparison to jq:

jq (the dominant CLI tool) has its own syntax, more powerful than JSONPath (functions, pipelines, transformations). JSONPath is simpler, more widely supported in libraries. For quick extraction: JSONPath. For complex transformations: jq.

Comparison to XPath:

XPath queries XML with similar syntax. JSONPath modeled on XPath for JSON. Most XPath concepts have JSONPath equivalents but syntax differs slightly.

Common problems and solutions

Different implementations behave differently

Goessner JSONPath, Jayway JSONPath, RFC 9535 all have subtle differences. This tool follows RFC 9535. Your library may differ. Check your library's docs for edge cases.

Escape special characters

Keys with special chars need [bracket-notation]: $['key-with-hyphen'] instead of $.key-with-hyphen. Quotes escape as needed.

Filter syntax complexity

[?(@.age > 18)] — note the parentheses and @. Filter expressions use @ for current node. Missing @ is common bug: @.age not just age.

Array vs single result

$.users[0] returns one user. $.users[*] returns array of users. $.users[0,1] returns array with 2 users. Consumer must handle both.

Recursive descent returns many matches

$..name may return dozens or hundreds. Performance can suffer on huge docs. Be specific when possible.

Missing paths return empty

$.nonexistent.path returns empty array, not null, not error. Check result count before processing.

Case sensitivity

JSONPath is case-sensitive. $.name differs from $.Name.

Number formatting in filters

$.items[?(@.price > 100)] works. $.items[?(@.price > "100")] compares string-to-string differently. Watch for type coercion.

JSON Path Evaluator — comparisons and alternatives

JSONPath vs jq: Both query JSON. jq is more powerful (transformations, functions, pipes). JSONPath is simpler and has library support in many languages. jq is CLI; JSONPath is library-first.

JSONPath vs XPath: XPath for XML. JSONPath modeled on XPath for JSON. Similar concepts, different syntax. XPath is more mature; JSONPath is newer but sufficient for most JSON queries.

JSONPath vs JMESPath: JMESPath is an alternative JSON query language (AWS adopted it for CLI). More powerful than JSONPath, different syntax. Both have strong support.

JSONPath vs GraphQL: GraphQL is a query language for APIs (including what fields to return). JSONPath queries existing JSON. Different scope — GraphQL designs query at request time; JSONPath extracts from response.

This tool vs code evaluation: Tool helps debug JSONPath expressions. For production code, use JSONPath library in your language (jsonpath-ng in Python, jsonpath in JS, Jayway in Java).

RFC 9535 vs Goessner vs Jayway: RFC 9535 (2024) is the official standard. Goessner was de facto 2007-2024. Jayway (Java) is popular with some extensions. Libraries vary — check your implementation.

Frequently asked questions about the JSON Path Evaluator

What is JSONPath?

A query language for JSON, inspired by XPath for XML. Express paths to navigate and filter JSON: $.users[?(@.age > 18)].name extracts adult user names. Standardized as RFC 9535 (2024). Widely supported across programming languages.

What does the $ symbol mean?

$ represents the root of the JSON document. Every JSONPath expression starts with $. From root, navigate with . (property) and [] (array/property).

How do I filter an array?

Use [?(expression)]. Example: $.users[?(@.active == true)] returns all active users. Inside filter, @ refers to current element being tested. Expressions support comparison, logical operators, regex match.

What is recursive descent (..)?

.. finds matches at any depth. $..email finds every email property in the document — whether at $.user.email, $.contacts[0].email, or $.admin.backup.email. Powerful for exploring.

Is my JSON safe here?

Yes. Evaluation happens in your browser. JSON never uploads. Safe for production API responses, internal data.

Why is my JSONPath returning no results?

Common reasons: (1) Typo in path. (2) Missing @ in filter: [?(@.age > 18)] not [?(age > 18)]. (3) Case mismatch — $.name differs from $.Name. (4) Array vs object — [0] for array, .name for object.

JSONPath vs jq — which should I use?

JSONPath for library integration across languages (Python, JS, Java). jq for CLI scripting, complex transformations. For quick extraction in an API client library, JSONPath. For shell pipelines, jq.

Can JSONPath transform data?

Mostly extraction, not transformation. JSONPath can select fields but not reshape them. For transformations, use jq (CLI) or code in your language.

Does this work with the RFC 9535 standard?

Yes. RFC 9535 (2024) is the official JSONPath standard. This tool implements RFC 9535 with common extensions. Library behavior may vary slightly.

How do I handle special characters in keys?

Use bracket notation with quotes: $['key with spaces'], $['key-with-hyphen']. Dot notation only works for valid identifier keys.

Additional resources

Advertisement

Learn more

Explore more tools

200+ free tools that run in your browser.

Browse all tools →