JSONPath 쿼리 도구
JSONPath 표현식을 JSON 데이터에 실행하여 중첩된 구조를 추출, 필터링, 탐색하세요.
이 도구에 대해
JSON 문서를 붙여 넣고 JSONPath 쿼리를 실행하여 필요한 데이터를 정확히 추출하세요. 루트($), 자식(.key), 재귀 내림(..key), 와일드카드([*]), 배열 인덱스, 유니온, [?(@.age > 18)]와 같은 필터 표현식을 지원합니다. 결과는 빠른 재실행을 위한 쿼리 히스토리와 함께 강조 표시된 JSON으로 표시됩니다.
사용 방법
- 1 1단계: 왼쪽 입력 패널에 JSON 데이터를 붙여 넣거나 입력하세요.
- 2 2단계: 쿼리 필드에 JSONPath 표현식을 입력하세요(예: $.store.book[*].author).
- 3 3단계: '쿼리 실행'을 클릭하거나 Ctrl+Enter를 눌러 실행하세요.
- 4 4단계: 강조 표시된 JSON으로 일치 결과를 확인하세요. '결과 복사'를 클릭하여 클립보드에 복사하세요.
What JSONPath is for
JSONPath is a query language for JSON, the way XPath is a query language for XML. Instead of writing loops to dig through nested objects and arrays, you write one compact expression that describes where the data you want lives, and the engine walks the structure and returns every matching value. This tool runs JSONPath expressions against JSON you paste, entirely in your browser, and shows the matched values with syntax highlighting and a match count. It's distinct from a JSON formatter or validator: those check and pretty-print the whole document, whereas JSONPath extracts specific pieces from it.
The syntax, piece by piece
Every expression begins with $, the root of the document. From there you chain steps:
| Syntax | Meaning | Example |
|---|---|---|
.key or ['key'] | Child by name | $.store.bicycle |
[n] | Array element by index | $.store.book[2] |
[-1] | Index from the end | $.store.book[-1] |
[*] or .* | Every element/value (wildcard) | $.store.book[*].author |
.. | Recursive descent — search at any depth | $..price |
[a,b] | Union — several indices or keys at once | $.store.book[0,2] |
[?(...)] | Filter — keep elements matching a condition | $.store.book[?(@.price < 10)] |
Inside a filter, @ refers to the current element being tested. This engine supports existence checks (?(@.isbn) keeps items that have an isbn field) and comparisons with ==, !=, >, <, >=, and <= against a number, a quoted string, or true/false/null.
A worked example
Using the bookstore JSON the tool loads by default — a store with an array of four book objects and a bicycle — here is how a few queries resolve:
$.store.book[*].authorwalks every book and pulls its author, returning all four author names.$..priceuses recursive descent to find everypriceanywhere in the tree — the four book prices and the bicycle's, five matches in total. The leading$.storeis unnecessary because..already searches everywhere.$.store.book[?(@.price < 10)]filters the book array to just those under $10 — the two cheapest books — returning the whole object for each match, not only the price.$.store.book[?(@.category == 'fiction')]keeps the three fiction titles; note the single quotes around the string value.$.store.book[?(@.isbn)]is an existence filter: it returns only the books that carry anisbnfield, ignoring the two that don't.
The results panel shows the count (e.g. "5 matches") and pretty-prints the matched values; a single match is returned as the value itself, multiple matches as an array.
Filter vs. wildcard: a common confusion
A wildcard [*] returns every element; a filter [?(...)] returns only elements that pass a test. People often reach for a filter when they mean a wildcard, or forget that a filter only operates on an array — in this engine, applying [?(...)] to a plain object yields nothing. So query the array, then filter: $.store.book[?(@.price >= 10)] works, but pointing a filter at a single object does not.
Practical tips
- Use
..when you don't know the depth. If a field is buried at varying levels,$..fieldNamefinds them all without spelling out the path. - Quote string comparisons. Write
@.status == 'active', not@.status == active— an unquoted bare word won't match. - Test incrementally. Start with
$.store, confirm it returns the object, then add one step at a time. The match count tells you immediately when a step narrows to zero. - Click a sample query to load both the expression and the example JSON, then edit from there — the fastest way to learn the syntax by experiment.
- Remember
$matches one value, not a list. Returning multiple values requires a wildcard, union, recursive descent, or filter somewhere in the path.
Where JSONPath is genuinely useful
It shines for pulling a few fields out of large API responses, writing assertions in API tests ("the response has at least one order with status shipped"), configuring data pipelines and log processors, and exploring an unfamiliar JSON payload without writing throwaway code. Many tools — from jq-style processors to test frameworks and no-code platforms — accept JSONPath-style expressions, so the syntax transfers widely.
Everything runs locally
The JSON you paste and every query you run are processed entirely in your browser by a JavaScript engine; nothing is uploaded. That means you can safely test queries against sensitive or proprietary JSON, and the tool keeps working with your network disconnected. (Note this is a focused JSONPath implementation covering the operators above; very advanced extensions like array slices and script expressions aren't part of it.)