Blog post
JSONPath Guide: Query JSON Data Like SQL (with Examples)
Learn JSONPath syntax to query JSON data — basic expressions, wildcards, filters, recursive descent, and array slices. Includes JavaScript and Python examples.
Shashank Jain
Author


Article
What is JSONPath?
JSONPath is a query language for JSON, similar to XPath for XML. It lets you extract specific values from complex JSON structures using path expressions.
Basic Syntax
| Expression | Meaning |
|---|---|
| $.store.book[0].title | First book title |
| $.store.book[*].author | All book authors |
| $..author | All authors anywhere (recursive) |
| $.store.book[?(@.price < 10)] | Books cheaper than 10 |
| $.store.book[-1] | Last book |
| $.store.book[0:2] | First two books (slice) |
Filter Expressions
// All users with age over 18
$.users[?(@.age > 18)]
// Products in stock
$.products[?(@.inStock == true)]
// Items matching a string
$.items[?(@.status == 'active')]JavaScript: jsonpath-plus
import { JSONPath } from 'jsonpath-plus';
const result = JSONPath({
path: '$.store.book[?(@.price < 10)].title',
json: data
});
console.log(result); // array of matching valuesPython: jsonpath-ng
from jsonpath_ng import parse
expr = parse('$.store.book[*].author')
matches = [m.value for m in expr.find(data)]
print(matches)Test JSONPath expressions live against your own JSON using the JSONPath Tester at jsondecode.com.
Keep reading
Recent blogs

Jun 14, 2026
JSON in C#: System.Text.Json and Newtonsoft Complete Guide
Serialize and deserialize JSON in C# using System.Text.Json and Newtonsoft.Json with practical examples.

Jun 14, 2026
JSON to Markdown Table: Convert JSON Arrays Instantly
Convert JSON arrays to Markdown tables in JavaScript, Python, and with the free online tool.

Jun 14, 2026
JSON in TypeScript: Type-Safe Parsing and Validation
Stop using any for JSON in TypeScript — use Zod, type guards, and generics for fully type-safe parsing.