JSONPath Evaluator & Tester

Query, extract, and evaluate specific nodes or properties from JSON documents using JSONPath expressions in real time.

How to Use the JSONPath Evaluator

1

Input JSON Document

Paste your raw JSON object or array on the left, click Upload, or click Sample.

2

Enter JSONPath Expression

Type a JSONPath query (e.g. $.store.book[*].author) or pick an expression from the preset dropdown.

3

Evaluate & Export

Queries evaluate instantly in real time. Click Copy or Download to save the extracted sub-tree.

Tool Options

Dot & Bracket Selectors

Supports root references ($), child property access ($.store), and recursive descent wildcards ($..book).

Array Slicing & Filters

Filter array elements by slice ranges ([0:2]), wildcard matching ([*]), or script filter expressions ([?(@.price < 10)]).

Match Count & Export

Displays extracted match node counts and allows downloading the matched JSON sub-tree as a formatted file.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the JSONPath Evaluator do?

The JSONPath Evaluator parses and extracts targeted data structures from JSON documents using RFC 9535 and standard JSONPath syntax in real time. Executing 100% in-browser on blueutils.com, this tool performs recursive descent searches, slice filters, and predicate evaluations against JSON trees with instant preview capabilities.

  • Real-Time Interactive Path Auto-Suggestions: Discovers JSON hierarchy levels dynamically, showing Level 1 and nested keys as non-overlapping pill chips.
  • Hover Preview Engine: Hovering over path suggestions instantly streams filtered sub-trees to the output pane without modifying your query buffer.
  • Comprehensive Syntax Support: Supports root references ($), property dots (.key), array wildcards ([*]), slice ranges ([0:3], [-1:]), and comparison predicates ([?(@.price < 10)]).

Core Concepts & Technical Specifications

  1. Path Syntax & AST Traversal Mechanics:
    • Root Anchor ($): Binds to the document root. Evaluating $ returns the entire input payload as a single-element matching array.
    • Recursive Descent ($..property): Recursively traverses every nested dictionary and array level to collect matching property values across arbitrarily deep AST hierarchies.
    • Array Slicing ([start:end:step]): Extracts subsets of array elements using standard 0-indexed slicing (e.g. [0:2] takes the first 2 items, [-1:] retrieves the tail element).
  2. Predicate Filters & Comparison Grammar:
    • Predicates evaluate conditions against the current node token (@).
    • Expressions like [?(@.price < 20)] or [?(@.status == 'active')] support standard operators (==, !=, <, <=, >, >=) without arbitrary code execution risk.
  3. In-Browser Privacy & Performance:
    • Queries are processed directly inside your browser engine using zero-allocation memory buffers.
    • Payloads are never transmitted to backend servers or logged in external databases.

How to use the tool?

  1. Supply Target Document:
    • Paste a raw JSON object or array into the left editor, click Upload to load a local .json file, or click Sample to load a sample e-commerce document.
  2. Build Query Interactively or Type:
    • Hover over pathInput to reveal Level 1 keys in the suggestion bar. Hover over any pill chip to preview filtered data in real time, or click to drill down into deeper nested properties.
  3. Export 3-Part Report:
    • Click Copy or Download to export a clean plain-text log containing the filter expression, raw source data, and formatted JSON query results formatted for developer handoffs.

Pipeline & Contextual Workflows

  • Tabular Conversion Pipeline: Extract an array of objects via $.items[*] here, then pipe the filtered array into JSON to CSV Converter for tabular spreadsheet analysis.
  • Pre-Validation Sanitization: Run raw payloads through JSON Syntax Validator to eliminate trailing commas or malformed quotes before querying.
  • Schema & Type Extraction: Once you isolate a sub-model using JSONPath, pass the extracted JSON node into JSON to TypeScript to generate domain interface definitions.

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/json/path-evaluator) to programmatically query JSON trees in automated integration pipelines, serverless functions, and backend services.

API Request Parameters

Name Type Description Example
rawText / json String / Object Raw JSON payload string or parsed native JSON object to query. {"store":{"book":[{"title":"Moby Dick","price":8.99}]}}
pathExpression String Standard JSONPath query expression (defaults to "$"). "$.store.book[*].title"

API Request Payload Examples

cURL (Using Direct JSON Object)

curl -X POST https://blueutils.com/api/json/path-evaluator \
  -H "Content-Type: application/json" \
  -d '{
    "json": {
      "store": {
        "book": [
          { "title": "Sayings of the Century", "price": 8.95 },
          { "title": "Sword of Honour", "price": 12.99 }
        ]
      }
    },
    "pathExpression": "$.store.book[*].title"
  }'

cURL (Using Raw String Payload)

curl -X POST https://blueutils.com/api/json/path-evaluator \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "{\"store\":{\"book\":[{\"title\":\"Sayings\",\"price\":8.95}]}}",
    "pathExpression": "$..price"
  }'

Python

import requests

url = "https://blueutils.com/api/json/path-evaluator"
payload = {
    "json": {
        "store": {
            "book": [
                {"title": "Sayings of the Century", "price": 8.95},
                {"title": "Sword of Honour", "price": 12.99}
            ]
        }
    },
    "pathExpression": "$.store.book[?(@.price < 10)].title"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = """
            {
                "rawText": "{\\"store\\":{\\"book\\":[{\\"author\\":\\"Nigel Rees\\",\\"price\\":8.95}]}}",
                "pathExpression": "$.store.book[*].author"
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/json/path-evaluator"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Indicates whether the query evaluation succeeded. true
pathExpression String Echoes the executed JSONPath query expression. "$.store.book[*].title"
count Number Total number of matching elements extracted. 2
data Array / Object Array of extracted data nodes matching the expression. ["Sayings of the Century", "Sword of Honour"]
formattedResult String Pretty-printed JSON string representation of matching results. "[\n \"Sayings of the Century\"\n]"
error String Detailed error explanation returned on query or syntax failure. "Invalid JSON syntax: Unexpected token '}' (Line 2)"

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "pathExpression": "$.store.book[*].title",
  "count": 2,
  "data": [
    "Sayings of the Century",
    "Sword of Honour"
  ],
  "formattedResult": "[\n  \"Sayings of the Century\",\n  \"Sword of Honour\"\n]"
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid JSON syntax: Unexpected token '}' at line 3 column 1"
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Why use an API to evaluate JSONPath?

Programmatic JSONPath extraction simplifies data processing in distributed architectures:

  • Webhook Filtering & Transformation: Extract matching identifiers from third-party webhook payloads before enqueueing jobs into message brokers.
  • LLM Context Minimization: Autonomous agents query and isolate sub-trees from large documents via API, reducing token consumption in prompt windows.
  • Contract & Response Verification: Extract and assert expected array elements in end-to-end integration tests without manual deserialization code.

Native Usage

Query JSON documents locally in terminal environments, scripts, and code editors:

Kubernetes CLI (kubectl)

# Extract all pod names across namespaces
kubectl get pods -A -o jsonpath='{.items[*].metadata.name}'

# Extract container images for a specific deployment
kubectl get deployment auth-service -o jsonpath='{.spec.template.spec.containers[*].image}'

Linux / macOS (jq comparison)

# Query nested elements with jq
cat data.json | jq '.store.book[] | select(.price < 10) | .title'

Python (jsonpath-ng)

import json
from jsonpath_ng import parse

with open('data.json') as f:
    data = json.load(f)

jsonpath_expr = parse('store.book[*].author')
matches = [match.value for match in jsonpath_expr.find(data)]
print("Extracted Authors:", matches)

Node.js (jsonpath-plus)

const { JSONPath } = require('jsonpath-plus');
const data = require('./data.json');

const authors = JSONPath({ path: '$.store.book[*].author', json: data });
console.log('Authors:', authors);

Java (Jayway json-path)

import com.jayway.jsonpath.JsonPath;
import java.util.List;

public class JsonPathExample {
    public static void main(String[] args) {
        String json = "{\"store\":{\"book\":[{\"author\":\"Nigel Rees\"},{\"author\":\"Evelyn Waugh\"}]}}";
        List<String> authors = JsonPath.read(json, "$.store.book[*].author");
        System.out.println("Authors: " + authors);
    }
}

Frequently Asked Questions (FAQ)

What does the $.. recursive descent operator do in JSONPath?

The $.. operator recursively scans all nested levels of a JSON document hierarchy, extracting all matching property values regardless of their depth (for example, $..price retrieves all price values throughout the JSON document).

How do I filter JSON arrays with comparison expressions in JSONPath?

Use bracket filter syntax with the current-node operator '@'. For example, $.store.book[?(@.price < 10)] filters books cheaper than $10, and $.users[?(@.role == "admin")] filters users with the admin role.

What is the difference between JSONPath and jq?

JSONPath is a query expression syntax supported natively across libraries in Python, Java, JavaScript, and Kubernetes, whereas jq is a full-featured standalone command-line scripting language with custom transformations and streaming filters.

How does JSONPath array slicing syntax work?

JSONPath array slicing uses [start:end] notation. For example, [0:2] selects the first two array items, [-1:] selects the last element, and [:3] selects the first three elements.

How to use JSONPath in Kubernetes kubectl commands?

In kubectl, use the flag -o jsonpath={...}. For example, kubectl get pods -o jsonpath="{.items[*].metadata.name}" extracts and prints all pod names in your Kubernetes cluster.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.