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
- 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).
- Root Anchor (
- 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.
- Predicates evaluate conditions against the current node token (
- 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?
- Supply Target Document:
- Paste a raw JSON object or array into the left editor, click Upload to load a local
.jsonfile, or click Sample to load a sample e-commerce document.
- Paste a raw JSON object or array into the left editor, click Upload to load a local
- Build Query Interactively or Type:
- Hover over
pathInputto 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.
- Hover over
- 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);
}
}