JSONPath Evaluator & Tester

Live interactive JSONPath query evaluator supporting recursive descent, wildcard matching, and property selection.

4.9 / 5· 148 verified ratings
•
100% Client-Side Privacy
•
Verified 2026 Engine
Loading tool engine...
Frequently Used With:JSON Formatter & Validator →JSON Diff & Comparison Tool →XML to JSON Converter →YAML to JSON Converter →
Institutional-Grade Accuracy & Client-Side Privacy Guarantee

Unlike conventional calculator sites that send your financial numbers, payload data, or code snippets across remote web servers, Affi-Chain processes all mathematical derivations, algorithms, and data parsing 100% locally within your browser sandbox. No tracking cookies, no server-side retention, and zero transmission lag.

What is JSONPath?

JSONPath is a declarative domain-specific query language designed to navigate, filter, and extract targeted fragments from structured JavaScript Object Notation (JSON) trees. Originally conceived in 2007 by software engineer Stefan Gössner as the JSON equivalent to XML's XPath, JSONPath was officially formalized by the Internet Engineering Task Force (IETF) in February 2024 as RFC 9535 (JSONPath: Query Expressions for JSON).

In modern cloud engineering, DevOps automation, and API testing, JSONPath is the ubiquitous query standard:

  • Kubernetes CLI (kubectl): Extracting pod status, cluster IPs, and container images from cluster manifests: kubectl get pods -o jsonpath='{.items[*].status.podIP}'.
  • API Testing & Contract Automation (Postman, RestAssured): Asserting response payloads in automated CI/CD test suites.
  • Enterprise Integration & Event Routing (AWS Step Functions, Apache Camel): Filtering and transforming event-driven JSON payloads in transit.
  • Relational SQL Database Ingestion: Querying semi-structured JSON columns in PostgreSQL (jsonb_path_query()) and MySQL (JSON_EXTRACT()).

Standard JSONPath Syntax Architecture (RFC 9535)

A JSONPath expression traverses a JSON document starting from the root node ($) down to specific child nodes, using either dot-notation ($.store.book) or bracket-notation ($['store']['book']):

flowchart TD
    Root["$ (Root Document Context)"] --> Step1["Step 1: Child Navigation ($.store)"]
    Step1 --> Step2["Step 2: Array Access ($.store.book[*])"]
    Step2 --> Filter["Step 3: Filter Expression [?(@.price < 10)]"]
    Filter --> Extract["Step 4: Leaf Extraction (.title)"]
    Extract --> Result["Output: ['Sayings of the Century', 'Moby Dick']"]

Comprehensive Syntax Token Reference

Syntax TokenExpression NameCanonical Behavioral DefinitionExample Expression
$Root ObjectAnchors the query to the root of the JSON document context.$
@Current NodeRefers to the current element being evaluated inside a filter predicate.[?(@.price < 20)]
.Child OperatorAccesses a child property of an object.$.store.book
..Recursive DescentDeep search; scans all descendants at any nesting depth across the tree.$..author
*WildcardMatches all properties in an object or all elements in an array.$.store.book[*]
[n]Array IndexSelects an array element by zero-based integer index.$.store.book[0]
[-1:]Negative IndexAccesses elements relative to the end of the array (-1 = last element).$.store.book[-1:]
[start:end:step]Array SliceExtracts an array sub-slice (identical to Python array slicing).$.store.book[0:4:2]
?()Filter ExpressionEvaluates a logical boolean expression to filter objects or array elements.$.store.book[?(@.isbn)]
['key']Bracket PropertySafely accesses keys containing special characters, spaces, or dots.$['user.name']['meta-id']

Filter Predicate Expressions & Logical Operators

Filter expressions ([?(...)]) evaluate boolean logic against array elements, discarding any items that do not satisfy the criteria:

OperatorTypeSemantic DefinitionExample Filter Expression
==ComparisonExact equality comparison.[?(@.category == 'fiction')]
!=ComparisonInequality comparison.[?(@.status != 'archived')]
< / <=ComparisonLess than / Less than or equal to.[?(@.price <= 19.99)]
> / >=ComparisonGreater than / Greater than or equal to.[?(@.stock > 0)]
&&LogicalLogical AND; both conditions must be true.[?(@.price < 20 && @.rating >= 4.5)]
||LogicalLogical OR; at least one condition must be true.[?(@.role == 'admin' || @.is_super)]
!LogicalLogical NOT; inverts boolean outcome.[?(!@.is_deleted)]
ExistenceAttribute CheckEvaluates to true if the property exists on the object.[?(@.isbn)]
=~Regex (Jayway)Regular expression pattern matching against string values.[?(@.email =~ /.*@affichain\\.com$/)]

Dialect Matrix: RFC 9535 vs. Kubernetes vs. PostgreSQL

Feature DimensionIETF RFC 9535 (Modern Standard)Kubernetes kubectl JSONPathPostgreSQL jsonb_path_query()Jayway JSONPath (Java/Spring)
Root Symbol$$ or .$$
Filter Predicates[?(...)]UnsupportedSupported (? (...))Full Support ([?(...)])
Regex MatchingUnsupported in core specUnsupportedSupported via like_regexSupported via =~
Recursive DescentSupported ($..key)Supported (..key)Supported (.**.key)Supported ($..key)
Array Slicing[start:end:step]Unsupported (Index only)SupportedSupported
String Literal QuotesSingle quotes ('text')Double quotes ("text")Double quotes ("text")Both single and double

Practical Implementation Examples

Python: Robust JSONPath Query Execution (jsonpath-ng)

import json
from jsonpath_ng.ext import parse # pip install jsonpath-ng

sample_store_catalog = {
    "store": {
        "name": "AffiChain Digital Books",
        "book": [
            {"category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95},
            {"category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", "price": 12.99},
            {"category": "fiction", "author": "Herman Melville", "title": "Moby Dick", "isbn": "0-553-21311-3", "price": 8.99},
            {"category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of the Rings", "isbn": "0-395-19395-8", "price": 22.99}
        ],
        "bicycle": {"color": "red", "price": 19.95}
    }
}

def execute_jsonpath_query(payload: dict, query_expression: str) -> list:
    """Parses and executes a JSONPath expression against a dictionary."""
    jsonpath_expr = parse(query_expression)
    matches = jsonpath_expr.find(payload)
    return [match.value for match in matches]

# Queries Demonstration
print("1. All Book Authors ($..author):")
print(execute_jsonpath_query(sample_store_catalog, "$..author"))

print("\n2. Books cheaper than $10 ($..book[?(@.price < 10)].title):")
print(execute_jsonpath_query(sample_store_catalog, "$..book[?(@.price < 10)].title"))

print("\n3. Books with an ISBN attribute ($..book[?(@.isbn)].title):")
print(execute_jsonpath_query(sample_store_catalog, "$..book[?(@.isbn)].title"))

TypeScript / Node.js Query Engine (jsonpath-plus)

import { JSONPath } from 'jsonpath-plus';

const catalog = {
  inventory: [
    { id: 1, name: 'Server Rack A', status: 'active', temp: 32.4 },
    { id: 2, name: 'Server Rack B', status: 'warning', temp: 48.1 },
    { id: 3, name: 'Server Rack C', status: 'active', temp: 28.9 }
  ]
};

// Query for overheating racks
const overheatingRacks = JSONPath({
  path: '$.inventory[?(@.temp > 35)].name',
  json: catalog
});

console.log('Overheating Hardware:', overheatingRacks);
// Output: ['Server Rack B']

Critical Edge Cases & Common Query Traps

1. The Recursive Descent Performance Sink ($..)

Using deep recursive descent ($..id) on massive, multi-megabyte JSON documents forces the query engine to perform an exhaustive Depth-First Search (DFS) traversal across every object node in memory ($O(N)$ complexity). In high-throughput microservices, always provide explicit structural paths (e.g. $.data.users[*].id) to avoid CPU spikes.

2. Array Slices vs. Single Index Return Types

In JSONPath, selecting a single index ($.book[0]) returns the raw object value, while selecting an array slice ($.book[0:1]) returns an array containing that object ([ { ... } ]). Downstream consumer code that assumes an object will throw runtime TypeError exceptions if the query syntax emits a wrapped list.

Frequently Asked Questions

What does $ symbol represent in JSONPath?
The $ symbol denotes the root object or element of the JSON document being queried.

Explore Related Utilities