JSON Path Extractor

Query JSON with JSONPath or JMESPath-style expressions, inspect matched paths, and highlight extracted values in the original document

Example Results

2 examples

Extract admin names with JSONPath filters

Pull matching objects and individual fields from an API response, then inspect them in the highlighted JSON view

Expressions: 2, Matches: 2, highlighted JSON with $.users[0] and $.users[0].name
View input parameters
{ "jsonInput": "{\n \"users\": [\n { \"name\": \"Ada\", \"role\": \"admin\", \"score\": 9 },\n { \"name\": \"Linus\", \"role\": \"editor\", \"score\": 6 }\n ]\n}", "queryExpressions": "$.users[?(@.role == \"admin\")]\n$.users[*].name", "queryEngine": "jsonpath", "displayMode": "highlighted-json", "flattenArrays": true, "includeNullValues": false, "maxMatches": 20 }

Traverse nested arrays with JMESPath-style syntax

Use wildcard and comparison filters to extract high-value line items from nested order data

Matches: $.orders[0].items[1].sku, $.orders[1].items[0].sku
View input parameters
{ "jsonInput": "{\n \"orders\": [\n { \"id\": 1, \"items\": [{ \"sku\": \"A1\", \"price\": 9 }, { \"sku\": \"B2\", \"price\": 19 }] },\n { \"id\": 2, \"items\": [{ \"sku\": \"C3\", \"price\": 24 }] }\n ]\n}", "queryExpressions": "orders[*].items[?price >= 19][*].sku", "queryEngine": "jmespath", "displayMode": "match-list", "flattenArrays": true, "includeNullValues": false, "maxMatches": 10 }

Use one expression per line. Supports field access, array indexes, wildcards, and simple filters.

Key Facts

Category
Data & Tables
Input Types
textarea, select, checkbox, number
Output Type
html
Sample Coverage
4
API Ready
Yes

Overview

The JSON Path Extractor allows developers and data analysts to query complex JSON documents using JSONPath or JMESPath expressions. It instantly evaluates your queries, extracts matching nodes, and highlights the results directly within the original JSON structure for easy visual inspection and debugging.

When to Use

  • When you need to extract specific fields or objects from deeply nested API responses.
  • When filtering large JSON arrays based on conditional logic, such as finding items over a certain value.
  • When testing and debugging JSONPath or JMESPath expressions before implementing them in your application code.

How It Works

  • Paste your raw JSON payload into the input area.
  • Enter one or more JSONPath or JMESPath expressions, placing each on a new line.
  • Select your preferred query engine and adjust settings like array flattening or null value inclusion.
  • Review the extracted data either as a list of matches or highlighted directly within the original JSON.

Use Cases

Extracting user IDs or email addresses from a bulk user export JSON file.
Filtering server log JSON arrays to find entries with specific error codes or severity levels.
Validating data extraction logic for automated testing scripts or API integrations.

Examples

1. Extracting Admin Users from API Response

Backend Developer
Background
A developer is inspecting a user list API response containing dozens of user objects with various roles.
Problem
Needs to quickly verify which users have the 'admin' role without manually reading the entire JSON payload.
How to Use
Paste the JSON response, select the JSONPath engine, and enter `$.users[?(@.role == "admin")]` in the query expressions field.
Example Config
Query Engine: JSONPath, Display Mode: Highlighted JSON
Outcome
The tool highlights only the user objects where the role is 'admin' directly in the JSON view, making them easy to spot.

2. Finding High-Value Order Items

Data Analyst
Background
An analyst has a nested JSON export of customer orders and their individual line items.
Problem
Needs to extract the SKUs of all items priced at $19 or higher across all orders.
How to Use
Input the order JSON, switch to the JMESPath engine, and query `orders[*].items[?price >= 19][*].sku`.
Example Config
Query Engine: JMESPath, Display Mode: Match List, Flatten Arrays: True
Outcome
Outputs a clean, flat list of SKUs for all items meeting the price condition, ignoring the rest of the order data.

Try with Samples

json

Related Hubs

FAQ

What is the difference between JSONPath and JMESPath?

JSONPath is a standard query language for JSON, often using `$.` syntax. JMESPath is another query language optimized for complex filtering and transformations, commonly used in tools like the AWS CLI.

Can I run multiple queries at once?

Yes, you can enter multiple expressions by placing each one on a new line in the query input field.

What does the 'Flatten Array Results' option do?

It merges nested arrays returned by your queries into a single, flat list, making it easier to read and copy the extracted values.

How are the results displayed?

You can choose 'Highlighted JSON' to see matches colored within your original input, or 'Match List' to see only the extracted values and their exact paths.

Is there a limit to the number of matches?

Yes, to ensure performance, the tool limits the output to a maximum number of matches, which you can adjust up to 200 using the settings.

API Documentation

Request Endpoint

POST /en/api/tools/json-path-extractor

Request Parameters

Parameter Name Type Required Description
jsonInput textarea Yes -
queryExpressions textarea No Use one expression per line. Supports field access, array indexes, wildcards, and simple filters.
queryEngine select No -
displayMode select No -
flattenArrays checkbox No -
includeNullValues checkbox No -
maxMatches number No -

Response Format

{
  "result": "
Processed HTML content
", "error": "Error message (optional)", "message": "Notification message (optional)", "metadata": { "key": "value" } }
HTML: HTML

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-json-path-extractor": {
      "name": "json-path-extractor",
      "description": "Query JSON with JSONPath or JMESPath-style expressions, inspect matched paths, and highlight extracted values in the original document",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=json-path-extractor",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]