2ClickKit

JSONPath Evaluator & Query Tester

Files Never Leave Your Device

Test and debug JSONPath expressions online in real time. Features full RFC 9535 syntax support, recursive descent, array slicing, filters, and 100% in-browser evaluation.

$
Presets:
JSON Source Document
Evaluation Results4 Matches

Declarative Querying in Hierarchical Documents: The Architecture of JSONPath

As software architectures transitioned from monolithic databases toward distributed microservices, REST APIs, and event-driven architectures, JSON emerged as the lingua franca of network payloads. However, extracting specific values from deeply nested, heterogeneous JSON trees frequently required verbose, brittle boilerplate code in languages like JavaScript, Python, Go, and Java.

In 2007, computer scientist Stefan Goessner introduced JSONPath as a declarative query language inspired by XML's XPath. Recently codified by the Internet Engineering Task Force in RFC 9535, JSONPath provides a standardized syntax for locating, slicing, and filtering data within arbitrary JSON trees without requiring programmatic traversal loops.

Today, JSONPath is deeply embedded in enterprise infrastructure: Kubernetes administrators query cluster pods via kubectl -o jsonpath, AWS engineers orchestrate microservices with AWS Step Functions, and QA automation suites validate API responses using REST Assured and Karate.

JSONPath Syntax Reference Matrix

The table below illustrates core JSONPath operators alongside their XPath equivalents and behavioral definitions:

JSONPath Token XPath Equivalent Syntactic Semantics & Description Example Query
$ / The root object or array of the JSON document $
.key /key Child property accessor for alphanumeric identifiers $.store.book
['key'] /key Bracketed child property accessor for special characters $['x-request-id']
..key //key Recursive descent: searches all descendant levels $..author
* * Wildcard: matches all child elements or object values $.store.book[*]
[n] [n+1] Array index accessor (zero-indexed) $.store.book[0]
[start:end] N/A Array slice operator (sub-array selection) $.store.book[0:2]
[?(<expr>)] [<expr>] Filter expression: evaluates boolean predicate on items $[?(@.price < 10)]
@ . The current node being processed in a filter predicate @.isbn

Deep Dive: Filter Expressions and Predicates

Filter expressions represent the most versatile capability in the JSONPath specification. Rather than blindly returning entire collections, filters interrogate each element within an array and yield only records satisfying strict logical criteria:

// Select all books in the 'fiction' category costing under $15
$.store.book[?(@.category == 'fiction' && @.price < 15)]

Common filter patterns include:

  • Property Existence: $[?(@.isbn)] checks whether a property exists and is not null.
  • Numerical Comparison: $[?(@.rating >= 4.5)] filters against floating-point or integer thresholds.
  • String Equality: $[?(@.status == "COMPLETED")] validates exact wire value matches.
  • Compound Logic: Combining multiple conditions using logical AND (&&) and logical OR (||).

JSONPath in DevOps and Cloud Automation

Understanding JSONPath is a superpower for cloud and infrastructure engineers. Here are real-world production use cases:

1. Kubernetes Administration (kubectl)

When diagnosing a Kubernetes cluster, kubectl outputs verbose JSON definitions for pods, nodes, and ingress controllers. JSONPath allows administrators to extract high-signal diagnostics instantly:

# Extract all pod names and their assigned node IPs
kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'

# Extract image tags across all production deployments
kubectl get deployments -n prod -o jsonpath='{.items[*].spec.template.spec.containers[*].image}'

2. AWS Step Functions and State Machine Routing

In AWS serverless architectures, Step Functions utilize JSONPath to select and manipulate data as it flows between state machine tasks:

{
  "Type": "Task",
  "Resource": "arn:aws:lambda:us-east-1:123456789012:function:ProcessOrder",
  "InputPath": "$.order.details",
  "ResultPath": "$.order.processingResult",
  "OutputPath": "$"
}

By defining InputPath with JSONPath, only the details sub-object is sent to the Lambda worker, minimizing memory footprint and network payload serialization latency.

Array Slicing Mechanics: Python-Style Indices

JSONPath array slicing mirrors Python's slice notation, following the convention [start:end:step]:

  • [0:5] selects the first 5 elements (indices 0, 1, 2, 3, 4).
  • [-1:] extracts only the final element of an array, regardless of array length.
  • [::2] steps through the array selecting every second element (even indices).
  • [-3:] extracts the last three elements of a log stream or time-series record.

Zero-Knowledge Local Browser Processing

Enterprise software schemas frequently contain sensitive organizational models, private database keys, and proprietary payload structures. 2ClickKit ensures absolute privacy by processing all JSON documents directly within your client web browser. No data packets are ever transmitted across the internet, logged in external caches, or stored on third-party infrastructure.

How to Use How to Test and Evaluate JSONPath Expressions

  1. Load or Paste JSON Document

    Paste any JSON payload or document into the left editor or load the sample bookstore dataset.

  2. Input JSONPath Expression

    Type your JSONPath query into the expression bar (e.g. $.store.book[*].author) or click one of the quick preset shortcuts.

  3. Real-Time Query Execution

    The client-side engine evaluates filters, wildcard expansions, array slices, and recursive descent scans in real time.

  4. Copy Matches or Export Result

    Copy the extracted JSON subset directly to your clipboard or download as a standalone .json file.

Technical Specifications

  • Supported Inputs: Text, Files, Raw Data
  • Input Limit: No strict limit (Client-side execution)
  • Processing Engine: 100% In-Browser (Client-Side Execution)
  • Content Uploads: None (Your files and text are processed locally on your device with zero uploads)

Privacy & Security Guarantee

Your files and text content are processed entirely in your web browser's memory using native client-side web technologies. Unlike traditional cloud tools, your content is never uploaded to remote servers, stored on external disks, or analyzed by third parties.

2ClickKit In-Browser vs Traditional Cloud Tools

Feature 2ClickKit (In-Browser) Traditional Cloud Services
Data Privacy Files never leave your local device Uploaded to remote servers and third-party clouds
Processing Speed Instant local execution (0ms upload time) Constrained by internet upload & server processing queues
Account & Costs 100% Free with zero registration or paywalls Tiered subscriptions, limits, or forced sign-ups

Best Practices & Tips

  • Use $..key when you do not know the exact nesting depth of a field in a complex payload.
  • Combine filters with property projections: $.items[?(@.status == "active")].id extracts only IDs of active items.
  • Enclose special keys in single quotes within brackets: $['content-type'] for keys containing hyphens.
  • Verify array filters with existence checks: $[?(@.optionalField)] filters for records where the field exists.

Frequently Asked Questions

What is JSONPath and what problem does it solve?

JSONPath is an expression language designed by Stefan Goessner in 2007 (and standardized in RFC 9535) for navigating, filtering, and extracting data from JSON documents. Just as XPath provides declarative querying for XML, JSONPath enables developers to extract deeply nested values without writing brittle manual loops or navigation code.

What is the difference between dot notation ($.store) and bracket notation ($['store'])?

Both notations navigate object properties. Dot notation ($.store.book) is more concise but requires property names to be valid alphanumeric identifiers. Bracket notation ($['store-name']['item-id']) is required when property names contain hyphens, whitespace, punctuation, or special characters.

What does the recursive descent operator (..) do?

The double dot operator (..) recursively traverses the entire JSON hierarchy from the current node down to all leaf nodes. For example, '$..price' traverses all nested objects and arrays throughout the document and gathers every property named 'price' into a flattened result array.

How do filter expressions like [?(@.price < 10)] work?

Filter expressions evaluate a boolean predicate against each item in an array. The '@' symbol represents the current element being evaluated. The expression [?(@.price < 10)] filters array items and only emits those whose price property is strictly less than 10.

Can I use array slicing like [0:2] or negative indices in JSONPath?

Yes. JSONPath supports Python-style slice syntax: [start:end:step]. For instance, [0:2] returns the first two elements of an array, while [-1] selects the final element, and [1:] selects all elements starting from index 1 to the end.

Where is JSONPath supported in modern cloud and DevOps stacks?

JSONPath is natively supported in Kubernetes (kubectl -o jsonpath='...'), AWS Step Functions, GCP Cloud Monitoring, PostgreSQL (jsonb_path_query), REST Assured test frameworks, and modern API gateways like Kong and Apigee.

Is any of my JSON data transmitted over the internet?

No. All parsing, AST compilation, and JSONPath evaluation execute 100% locally in your web browser. Zero network requests or tracking pixels are dispatched, ensuring total confidentiality for internal corporate data.